当前位置: 首页>>代码示例>>Python>>正文


Python checkbox.CheckBox类代码示例

本文整理汇总了Python中kivy.uix.checkbox.CheckBox的典型用法代码示例。如果您正苦于以下问题:Python CheckBox类的具体用法?Python CheckBox怎么用?Python CheckBox使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CheckBox类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

 def __init__(self, **kwargs):
     super(LoginScreen, self).__init__(**kwargs)
     #self.cols = 3       # 3 columns 
     self.rows = 4       # 4 rows 
     self.add_widget(Label(text='User Name'))        # add widget label : content User Name
     self.username = TextInput(multiline=False)      # no multiline text input support
     self.add_widget(self.username)                  # add 'username' textinput
     self.add_widget(Label(text='Pass Word'))        # add widget label : content User Name
     self.password = TextInput(multiline=False, password=True)   #password auto-hidden
     self.add_widget(self.password)
     self.btn1 = Button(text='Login', fontsize=14)   # add login button
     self.add_widget(self.btn1)
     self.btn2 = Button(text='Sign up', fontsize=14) # add Sign up button
     self.add_widget(self.btn2)
     
     def on_checkbox_active(checkbox, value):            
         '''
         Once checkbox's state is changed.
         if checked, then pass "True" to on_checkbox_active
         if not, then pass "False" to on_checkbox_active
         '''
         if value:
             pass
         else:
             pass
     checkbox = CheckBox()
     checkbox.bind(active=on_checkbox_active)            #checked , then dispatch to on_checkbox_active
     self.add_widget(checkbox)                      # add check box to remember password
开发者ID:xros,项目名称:kivy_practice,代码行数:28,代码来源:button_copied.py

示例2: RootWidget

class RootWidget(GridLayout):
    def __init__(self, **kwargs):
        super(RootWidget, self).__init__(cols=2)

        self.label=Label(text="Check 1")
        self.add_widget(self.label)

        self.checkbox = CheckBox()
        self.checkbox.bind(active=self.on_checkbox_active)
        self.add_widget(self.checkbox)

        self.label=Label(text="Check 2")
        self.add_widget(self.label)

        checkbox1 = CheckBox()
        self.add_widget(checkbox1)

        self.label=Label(text="Check 3")
        self.add_widget(self.label)

        checkbox3 = CheckBox()
        self.add_widget(checkbox3)
 
    def on_checkbox_active(self, checkbox, value):
        if value:
            print('The checkbox', checkbox, 'is active')
        else:
            print('The checkbox', checkbox, 'is inactive')
开发者ID:AtsushiSakai,项目名称:kivy_samples,代码行数:28,代码来源:main.py

示例3: __init__

 def __init__(self, **kwargs):
   barsize = kwargs.pop('n', 1)
   self.value = "0" * barsize
   self.orientation = 'vertical'
   self.color = kwargs.pop('color', (0.2, 0.2, 0.2, 0.5))
   self.callback = kwargs.pop('callback', lambda: None)
   self.height = 70
   self.padding = 10
   self.spacing = 10
   self.size_hint = (1, None)
   super(ToggleBar, self).__init__(**kwargs)
   self.checkboxes = []
   box = BoxLayout(orientation='horizontal')
   box.size_hint = (1, 0.6)
   
   for n in range(barsize):
     checkbox = CheckBox(size_hint=(1.0/barsize, 0.70))
     checkbox.bind(active=self.checkbox_toggle)
     box.add_widget(checkbox)
     self.checkboxes.append(checkbox)
   
   if 'label' in kwargs:
     self.label = Label(text=kwargs['label'], markup=True, size_hint=(1, 0.3))
     self.add_widget(self.label)
   
   self.add_widget(box)
   self.value_label = Label(text="0"*barsize)
   self.value_label.size_hint = (1, 0.3)
   self.add_widget(self.value_label)  
开发者ID:rechner,项目名称:ieee754converter,代码行数:29,代码来源:main.py

示例4: build

 def build(self): #UIの構築等
     args = sys.argv
     self.src = cv2.imread(args[1], cv2.IMREAD_GRAYSCALE)
     if self.src is None:
         return -1
     self.src = cv2.flip(self.src, 0)
     # ButtonやSlider等は基本size_hintでサイズ比率を指定(絶対値の時はNoneでsize=)
     # Imageに後で画像を描く
     self.kvImage1 = Image(size_hint=(1.0, 0.9))
     # Layoutを作ってadd_widgetで順次モノを置いていく(並びは置いた順)
     kvBoxLayout1 = BoxLayout(orientation='vertical')
     kvBoxLayout1.add_widget(self.kvImage1)
     # 複数行に何か並べる場合はGridLayoutの方が楽そう
     kvGridLayout1 = GridLayout(cols = 2, size_hint=(1.0, 0.1))
     kvCheckBox1Label = Label(text = 'Sobel', halign='right')
     self.kvCheckBox1 = CheckBox(group = 'method', active= True)
     self.kvCheckBox1.bind(active = self.on_checkbox_active)
     kvCheckBox2Label = Label(text = 'Canny', halign='right')
     self.kvCheckBox2 = CheckBox(group = 'method')
     self.kvCheckBox2.bind(active = self.on_checkbox_active)
     kvGridLayout1.add_widget(kvCheckBox1Label)
     kvGridLayout1.add_widget(self.kvCheckBox1)
     kvGridLayout1.add_widget(kvCheckBox2Label)
     kvGridLayout1.add_widget(self.kvCheckBox2)
     kvBoxLayout1.add_widget(kvGridLayout1)
     self.process()
     return kvBoxLayout1
开发者ID:eiichiromomma,项目名称:CVMLAB,代码行数:27,代码来源:testimg2.py

示例5: display_scene

    def display_scene(self, x):
        layout = StackLayout(orientation='tb-lr')
        if (x == 2):
            main = Label(text='WAVE MIXER', size_hint=(1, 0.03),
                         color=(1, 0, 0, 1), background_color=(1, 0, 0, 1))
        else:
            main = Label(text='', size_hint=(1, 0.03),
                         color=(1, 0, 0, 1), background_color=(1, 0, 0, 1))
        label1 = Label(text='File '+str(x), size_hint=(1, 0.1))
        select1 = Button(text='Select file',
                         size_hint=(1, 0.05), background_color=(1, 0, 0, 1))
        select1.bind(on_press=self.selectSound1)
        bt1 = Button(text='Play file', size_hint=(1, 0.05),
                     background_color=(1, 0, 0, 1))
        bt1.bind(on_press=self.callback)
        stop1 = Button(text='Stop Playing', size_hint=(1, 0.05),
                       background_color=(1, 0, 0, 1))
        stop1.bind(on_press=self.stopf1)
        label2 = Label(text='Amplitude', size_hint=(1, 0.1))
        label3 = Label(text='Time Shift', size_hint=(1, 0.1))
        label4 = Label(text='Time Scaling', size_hint=(1, 0.1))
        self.flag1 = 0
        self.flag2 = 0
        self.flag3 = 0
        self.s1 = Slider(min=0.0, max=5.0, value=1.0,
                         size_hint=(0.8, 0.02), background_color=(1, 0, 0, 1))
        self.s2 = Slider(min=-1.0, max=1.0, value=0.5, size_hint=(0.8, 0.02))
        self.s3 = Slider(min=0.0, max=8.0, value=2.0, size_hint=(0.8, 0.02))

        self.c1 = CheckBox(size_hint=(0.8, 0.05))
        self.c2 = CheckBox(size_hint=(0.8, 0.05))
        self.c3 = CheckBox(size_hint=(0.8, 0.05))
        label5 = Label(text='Time Reversal', size_hint=(1, 0.02))
        label6 = Label(text='Select for modulation', size_hint=(1, 0.02))
        label7 = Label(text='Select for mixing', size_hint=(1, 0.02))
        self.c1.bind(active=self.on_checkbox_active1)
        self.c2.bind(active=self.on_checkbox_active2)
        self.c3.bind(active=self.on_checkbox_active3)
        layout.add_widget(main)
        layout.add_widget(label1)
        layout.add_widget(select1)
        layout.add_widget(bt1)
        layout.add_widget(stop1)
        layout.add_widget(label2)
        layout.add_widget(self.s1)
        layout.add_widget(label3)
        layout.add_widget(self.s2)
        layout.add_widget(label4)
        layout.add_widget(self.s3)
        layout.add_widget(self.c1)
        layout.add_widget(label5)
        layout.add_widget(self.c2)
        layout.add_widget(label6)
        layout.add_widget(self.c3)
        layout.add_widget(label7)
        self.s1.bind(value=self.update_value1)
        self.s2.bind(value=self.update_value2)
        self.s3.bind(value=self.update_value3)
        self.lay1.add_widget(layout)
开发者ID:Jigar54,项目名称:WaveMixer,代码行数:59,代码来源:WaveMixer.py

示例6: display_scene2

    def display_scene2(self, x):
        layout2 = StackLayout(orientation='tb-lr')
        if (x == 2):
            main = Label(text='WAVE MIXER',
                         size_hint=(1, 0.03), color=(1, 0, 0, 1))
        else:
            main = Label(text='', size_hint=(1, 0.03),
                         color=(1, 0, 0, 1), background_color=(1, 0, 0, 1))
        label21 = Label(text='File '+str(x), size_hint=(1, 0.1))
        bt21 = Button(text='Play file', size_hint=(1, 0.05),
                      background_color=(1, 0, 0, 1))
        bt21.bind(on_press=self.callback2)
        stop3 = Button(text='Stop Playing', size_hint=(1, 0.05),
                       background_color=(1, 0, 0, 1))
        stop3.bind(on_press=self.stopf3)
        select3 = Button(text='Select file',
                         size_hint=(1, 0.05), background_color=(1, 0, 0, 1))
        select3.bind(on_press=self.selectSound3)
        label22 = Label(text='Amplitude', size_hint=(1, 0.1))
        label23 = Label(text='Time Shift', size_hint=(1, 0.1))
        label24 = Label(text='Time Scaling', size_hint=(1, 0.1))
        self.flag21 = 0
        self.flag22 = 0
        self.flag23 = 0
        self.s21 = Slider(min=0.0, max=5.0, value=1.0,
                          size_hint=(0.8, 0.02), background_color=(1, 0, 0, 1))
        self.s22 = Slider(min=-1.0, max=1.0, value=0.5, size_hint=(0.8, 0.02))
        self.s23 = Slider(min=0.0, max=8.0, value=2.0, size_hint=(0.8, 0.02))

        self.c21 = CheckBox(size_hint=(0.8, 0.05))
        self.c22 = CheckBox(size_hint=(0.8, 0.05))
        self.c23 = CheckBox(size_hint=(0.8, 0.05))
        label25 = Label(text='Time Reversal', size_hint=(1, 0.02))
        label26 = Label(text='Select for modulation', size_hint=(1, 0.02))
        label27 = Label(text='Select for mixing', size_hint=(1, 0.02))
        self.c21.bind(active=self.on_checkbox2_active1)
        self.c22.bind(active=self.on_checkbox2_active2)
        self.c23.bind(active=self.on_checkbox2_active3)
        layout2.add_widget(main)
        layout2.add_widget(label21)
        layout2.add_widget(select3)
        layout2.add_widget(bt21)
        layout2.add_widget(stop3)
        layout2.add_widget(label22)
        layout2.add_widget(self.s21)
        layout2.add_widget(label23)
        layout2.add_widget(self.s22)
        layout2.add_widget(label24)
        layout2.add_widget(self.s23)
        layout2.add_widget(self.c21)
        layout2.add_widget(label25)
        layout2.add_widget(self.c22)
        layout2.add_widget(label26)
        layout2.add_widget(self.c23)
        layout2.add_widget(label27)
        self.s21.bind(value=self.update2_value1)
        self.s22.bind(value=self.update2_value2)
        self.s23.bind(value=self.update2_value3)
        self.lay1.add_widget(layout2)
开发者ID:Jigar54,项目名称:WaveMixer,代码行数:59,代码来源:WaveMixer.py

示例7: __init__

    def __init__(self, **kwargs):
        global recflag
        recflag = False
        global text
        text = None
        super(CasterGUI, self).__init__(**kwargs)

        version_info = Label(text="NewsBcaster v0.1", font_size=20, size_hint=(1, 0.5),
                             pos_hint={"center_x": 0.5, "center_y": 0.95})

        start_button = Button(text="Start Broadcast", background_color=(0, 1, .5, 1), size_hint=(.25, .10),
                              pos_hint={"center_x": 0.25, "center_y": 0.85})

        start_button.bind(on_press=lambda x: self.callback_start())

        stop_button = Button(text="Stop Broadcast", background_color=(1, 0.1, 0.1, 1), size_hint=(.25, 0.10),
                             pos_hint={"center_x": 0.75, "center_y": 0.85})

        stop_button.bind(on_press=lambda x: self.callback_stop())

        path_to_video = TextInput(text="lmao.mp4", multiline=False, size_hint=(.60, 0.10),
                                  pos_hint={"center_x": .40, "center_y": .70})

        upload_video = Button(text="Upload Video", background_color=(0, 1, 1, 1), size_hint=(.20, .10),
                              pos_hint={"center_x": 0.80, "center_y": 0.70})

        overlay_text = TextInput(text="Headlines Go Here", multiline=True, size_hint=(.60, 0.10),
                                 pos_hint={"center_x": .40, "center_y": .15})

        upload_video.bind(on_press=lambda x: self.callback_upload(path_to_video.text, overlay_text.text))


        add_overlay = Button(text="Add Overlay", background_color=(1, 1, 1, 1), size_hint=(.20, 0.10),
                             pos_hint={"center_x": 0.80, "center_y": 0.15})

        # video_previewer = Video(source="lmao.mp4", state='play', size_hint=(.32, 0.20),
        # pos_hint={"center_x": 0.50, "center_y": 0.50})

        record_start = Button(text="Audio Recording", background_color=(0.9, 0.4, 0.1, 1), size_hint=(.20, .10),
                              pos_hint={"center_x": 0.75, "center_y": 0.30})

        checkbox = CheckBox(size_hint=(.10, .10), pos_hint={"center_x": 0.50, "center_y": 0.30})

        checkbox.bind(active=on_checkbox_active)

        fetch_headlines = Button(text="Fetch Headlines", background_color=(0.9, 0.4, 0.1, 1), size_hint=(.20, .10),
                                 pos_hint={"center_x": 0.25, "center_y": 0.30})

        fetch_headlines.bind(on_press=lambda x: self.fetch_start())

        record_start.bind(on_press=lambda x: self.rec_start())

        stop_button.bind(on_press=lambda x: self.rec_start())

        for widgets in [version_info, start_button, stop_button, add_overlay, path_to_video, overlay_text,
                        upload_video, record_start, fetch_headlines, checkbox]:
            self.add_widget(widgets)
开发者ID:sidzi,项目名称:NewsBroadCaster,代码行数:57,代码来源:run.py

示例8: __init__

 def __init__(self,**kwargs):
     super(StartWindow,self).__init__(**kwargs)
     inters=self.get_interfaces("ls /sys/class/net")
     self.iface="eth0"
     for iface in inters:
         lbl=Label(text=iface)
         cbok=CheckBox(group="face")
         cbok.bind(active=partial(self.set_interface,iface))
         self.ids["interfaces"].add_widget(lbl)
         self.ids["interfaces"].add_widget(cbok)
开发者ID:yahyakesenek,项目名称:Mitm-Tool,代码行数:10,代码来源:main.py

示例9: ActionCheckButton

class ActionCheckButton(ActionItem, BoxLayout):
    '''ActionCheckButton is a check button displaying text with a checkbox
    '''

    checkbox = ObjectProperty(None)
    '''Instance of :class:`~kivy.uix.checkbox.CheckBox`.
       :data:`checkbox` is a :class:`~kivy.properties.StringProperty`
    '''

    text = StringProperty('Check Button')
    '''text which is displayed by ActionCheckButton.
       :data:`text` is a :class:`~kivy.properties.StringProperty`
    '''

    cont_menu = ObjectProperty(None)

    __events__ = ('on_active',)

    def __init__(self, **kwargs):
        super(ActionCheckButton, self).__init__(**kwargs)
        self._label = Label()
        self.checkbox = CheckBox(active=True)
        self.checkbox.size_hint_x = None
        self.checkbox.x = self.x + 2
        self.checkbox.width = '20sp'
        BoxLayout.add_widget(self, self.checkbox)
        BoxLayout.add_widget(self, self._label)
        self._label.valign = 'middle'
        self._label.text = self.text
        self.checkbox.bind(active=partial(self.dispatch, 'on_active'))
        Clock.schedule_once(self._label_setup, 0)

    def _label_setup(self, dt):
        '''To setup text_size of _label
        '''
        self._label.text_size = (self.minimum_width - self.checkbox.width - 4,
                                 self._label.size[1])

    def on_touch_down(self, touch):
        '''Override of its parent's on_touch_down, used to reverse the state
           of CheckBox.
        '''
        if not self.disabled and self.collide_point(*touch.pos):
            self.checkbox.active = not self.checkbox.active
            self.cont_menu.dismiss()

    def on_active(self, *args):
        '''Default handler for 'on_active' event.
        '''
        pass

    def on_text(self, instance, value):
        '''Used to set the text of label
        '''
        self._label.text = value
开发者ID:5y,项目名称:kivy-designer,代码行数:55,代码来源:actioncheckbutton.py

示例10: getPropertyEditors

    def getPropertyEditors(self, skin):
        """
        get all the controls for editing the extra properties of this control.
        The list of controls that is returned, our bound to this object (changes will be stored in the skin object)
        :param skin: json object
        :return: a list of kivy controls that can be used for editing the properties for the skin.
        """
        items = []
        grd = GridLayout(cols=2)
        grd.bind(minimum_height = grd.setter('height'))
        grd.size_hint = (1, None)

        chk = CheckBox(active=sm.getVar(skin,  self.asset, "show_label", False), height='28dp', size_hint=(1, None))
        chk.bind(active=self.on_show_labelChanged)
        lbl = Label(text='show label', height='28dp', size_hint=(1, None), halign='right')
        lbl.bind(size = lbl.setter('text_size'))
        grd.add_widget(lbl)
        grd.add_widget(chk)

        chk = CheckBox(active=sm.getVar(skin,  self.asset, "show_marker", False), height='28dp', size_hint=(1, None))
        chk.bind(active=self.on_show_markerChanged)
        lbl = Label(text='show marker', height='28dp', size_hint=(1, None), halign='right')
        lbl.bind(size = lbl.setter('text_size'))
        grd.add_widget(lbl)
        grd.add_widget(chk)

        chk = CheckBox(active=sm.getVar(skin,  self.asset, "send_on_release", False), height='28dp', size_hint=(1, None))
        chk.bind(active=self.on_send_on_release_Changed)
        lbl = Label(text='send on release', height='28dp', size_hint=(1, None), halign='right')
        lbl.bind(size = lbl.setter('text_size'))
        grd.add_widget(lbl)
        grd.add_widget(chk)

        items.append(grd)
        return items
开发者ID:ATT-JBO,项目名称:att-dash,代码行数:35,代码来源:layout.py

示例11: buildCenterMenu

 def buildCenterMenu(self, wrapper, rebuild=False):
     if(rebuild): wrapper.clear_widgets()
     
     numberOfItems = len(self.sharedInstance.data.temp) if self.sharedInstance.data.temp else 0
     for i in range(0, numberOfItems):
         checkbox = CheckBox(active=True)
         checkbox.bind(active=app.checkBoxCallback)
         self.checkBoxesPlotBind[checkbox] = self.graphScreen.getGraph().plots[i]
         
         labelText = self.sharedInstance.data.temp[i] if self.sharedInstance.data.temp else "Nazwa atrybutu"
         label = Label(text=labelText, halign = "right",width=100, col_default_width=20, col_force_default=True)
         wrapper.add_widget(label)
         wrapper.add_widget(checkbox)
开发者ID:dworak,项目名称:SWD2014,代码行数:13,代码来源:main.py

示例12: agregar

	def agregar(self, nombre):

		box = BoxLayout()

		bloqueado = CheckBox(active= False)
		bloqueado.bind(active= lambda inst, valor : self.recursos[nombre].bloquear(valor))
			
		usado = Label(text="-")

		box.add_widget(Label(text=nombre))
		box.add_widget(usado)
		box.add_widget(bloqueado)

		self.add_widget(box)
		self.visores[nombre] = usado
开发者ID:jefree,项目名称:SimPlanOS,代码行数:15,代码来源:tablas.py

示例13: show_plugins

 def show_plugins(self, plugins_list):
     def on_checkbox_active(cb, value):
         self.plugins.toggle_enabled(self.electrum_config, cb.name)
     for item in self.plugins.descriptions:
         if 'kivy' not in item.get('available_for', []):
             continue
         name = item.get('name')
         label = Label(text=item.get('fullname'))
         plugins_list.add_widget(label)
         cb = CheckBox()
         cb.name = name
         p = self.plugins.get(name)
         cb.active = (p is not None) and p.is_enabled()
         cb.bind(active=on_checkbox_active)
         plugins_list.add_widget(cb)
开发者ID:Gamecredits-Universe,项目名称:Gamecredits-electrum-client,代码行数:15,代码来源:main_window.py

示例14: __init__

    def __init__(self, **kwargs):
        super(CategoryChecklist, self).__init__(**kwargs)
        self.cols = 4


        with conn:
            c = conn.cursor()
            c.execute("SELECT DISTINCT Category FROM Inventory")
            part = c.fetchall()
            for i in part:
                check = CheckBox(group='categories')
                check.id = i[0]
                check.bind(active=self.on_checkbox_active)
                print(check.id)
                self.add_widget(check)
                self.add_widget(Label(text=i[0]))
开发者ID:t0mAI,项目名称:Projects,代码行数:16,代码来源:testmain.py

示例15: __init__

 def __init__(self, **kwargs):
     super(Test_input, self).__init__(**kwargs)
     self.cols = 1
     self.text = Label(text='un label')
     self.add_widget(self.text)
     self.checkbox = CheckBox(text="Bifeaza-ma!")
     self.add_widget (self.checkbox)
     self.checkbox.bind(active=self.Ruleaza_la_activare)
开发者ID:afodor88,项目名称:curs_python,代码行数:8,代码来源:checkbox1.py


注:本文中的kivy.uix.checkbox.CheckBox类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。