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


Python ttk.Combobox类代码示例

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


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

示例1: __init__

 def __init__(self, boss, repertoire):
     contenu = listdir('Objets/' + repertoire)
     self.listObjets = {}
     listStrObjets = []
     for nom in contenu:
         self.listObjets[nom[:-4]] = Objet(repertoire, nom)  #Le [:-4] permet de supprimer le ".txt"
         listStrObjets.append(nom[:-4])
     Combobox.__init__(self, boss, values = listStrObjets, state='readonly')
开发者ID:Hugal31,项目名称:Donjon-Python,代码行数:8,代码来源:Magasin.py

示例2: createWidgets

    def createWidgets(self):
        
        frame1 = Frame(self)
        season_frame = Frame(frame1)
        self.seasonlabel = Label(season_frame, text="Season")
        season_list = ('2013-2014', '2012-2013', '2011-2012', '2010-2011',
                       '2009-2010', '2008-2009', '2007-2008', '2006-2007',
                       '2005-2006', '2003-2004', '2002-2003', '2001-2002',
                       '2000-2001', '1999-2000', '1998-1999', '1997-1998')
        self.season = Combobox(season_frame, values=season_list, state='readonly')
        self.season.current(0)
        self.seasonlabel.pack()
        self.season.pack()
        season_frame.pack(side=LEFT, padx=5, pady=5)

        position_frame = Frame(frame1)
        self.positionlabel = Label(position_frame, text="Position")
        position_list = ('All Skaters', 'Goalies', 'Forwards', 'Defenseman',
                         'Center', 'Left Wing', 'Right Wing')
        self.position = Combobox(position_frame, values=position_list, state='readonly')
        self.position.current(0)
        self.positionlabel.pack()
        self.position.pack()
        position_frame.pack(side=LEFT, padx=5, pady=5)
        frame1.pack(side=TOP)

        frame2 = Frame(self)
        gameType_frame = Frame(frame2)
        self.gameTypelabel = Label(gameType_frame, text="Game Type")
        gameType_list = ('Regular Season', 'Playoffs')
        self.gameType = Combobox(gameType_frame, values=gameType_list, state='readonly')
        self.gameType.current(0)
        self.gameTypelabel.pack()
        self.gameType.pack()
        gameType_frame.pack(side=LEFT, padx=5, pady=5)

        grouping_frame = Frame(frame2)
        self.groupinglabel = Label(grouping_frame, text="Grouping")
        grouping_list = ('By League', 'By Team')
        self.grouping = Combobox(grouping_frame, values=grouping_list, state='readonly')
        self.grouping.current(0)
        self.groupinglabel.pack()
        self.grouping.pack()
        grouping_frame.pack(side=LEFT, padx=5, pady=5)
        frame2.pack(side=TOP)

        frame3 = Frame(self)
        self.progress = Label(frame3, text="Choose Options and Press Start", relief=SUNKEN, width=30)
        self.progress.pack()
        frame3.pack(side=TOP, padx=5, pady=5)

        frame4 = Frame(self)
        self.start = Button(frame4, text="Start", command=self.start)
        self.QUIT = Button(frame4, text="Quit", command=self.quit)
        self.start.pack(side=LEFT)
        self.QUIT.pack(side=LEFT)
        frame4.pack(side=TOP)
开发者ID:lukerajnoha,项目名称:NHL-Stats-to-CSV,代码行数:57,代码来源:NHL-Stats-to-CSV.py

示例3: AlgoSelGroup

class AlgoSelGroup(Group):
    def __init__(self, *args, **kwargs):
        self._topwin  = kwargs.pop('topwin')
        super().__init__(*args, **kwargs)
        
        self.__algorithm_list = Combobox(self, value=[], takefocus=1, stat='readonly', width=12)
        self.__algorithm_list['values']   = []
        self.__algorithm_list.pack()
        self.__algorithm_list.bind('<<ComboboxSelected>>', self._on_algorithm_change)
        
        Button(self, text='Load Algorithm', command=self._on_load_algorithm).pack()
        Button(self, text='Reload', command=self._on_reload_algorithm).pack()
        
        self.name = 'Algorithms'          
        
        
    @property
    def algorithm_list(self):
        return self.__algorithm_list
        
        
    def _on_algorithm_change(self, event):
        self._topwin.change_algorithm(event.widget.get())
        
        
    def _on_load_algorithm(self):        
        new_thread_do = self._topwin.root_node.thread_manager.new_thread_do
        main_thread_do = self._topwin.root_node.thread_manager.main_thread_do
    
        @new_thread_do
        def select_and_load():
            class_info = ask_class_name('wavesynlib.algorithms', Algorithm)
            if not class_info:
                return
            module_name, class_name = class_info
            if isinstance(module_name, bytes):
                module_name = module_name.decode('utf-8')
            if isinstance(class_name, bytes):
                class_name = class_name.decode('utf-8')
            @main_thread_do()
            def load():
                with code_printer():
                    self._topwin.load_algorithm(module_name=module_name, class_name=class_name)
            
            
    def _on_reload_algorithm(self):
        with code_printer():
            self._topwin.current_algorithm.reload_algorithm()
开发者ID:xialulee,项目名称:WaveSyn,代码行数:48,代码来源:singlesyn.py

示例4: __init__

    def __init__(self, master=None):
        # Avoiding to send it continuously.
        self.lock = False

        Frame.__init__(self, master)
        self.grid()
        self.master = master
        # Setting for ComboBox.
        self.url_lang_combobox_str = StringVar()
        self.url_lang_combobox_list = lang_list
        # UI components.
        self.receiver_email_text = Label(self, text="Receiver:")
        self.receiver_email_field = Entry(self, width=50)
        self.subject_text = Label(self, text='Subject:')
        self.subject_field = Entry(self, width=50)
        self.receiver_name_text = Label(self, text='Name:')
        self.receiver_name_field = Entry(self, width=50)
        self.url_lang_text = Label(self, text='Link lang:')
        self.url_lang_combobox = Combobox(self, textvariable=self.url_lang_combobox_str, values=self.url_lang_combobox_list, state='readonly')
        self.send_progressbar = Progressbar(self, orient='horizontal', length=500, mode='determinate', maximum=300)
        self.send_button = Button(self, text='Send', command=self._send_mail)
        self.quit_button = Button(self, text='Exit', command=self.__exit)
        self.log_msg_text = ScrolledText(self)
        # Attachment.
        self.mail_attachment_list = attachment_list[:]
        self.url_lang_link_title = None
        self.url_lang_link = copy.deepcopy(content_link)
        # Mailer
        self._mailer = None

        # Let Mailer can control components.
        Mailer.window_content = self

        self.__create_widgets()
开发者ID:pokk,项目名称:Mailer,代码行数:34,代码来源:auto_mailer.py

示例5: __make_widgets

 def __make_widgets(self):
     widgets = {}
     for index, editor_field in enumerate(self.editor_fields):
         label = Label(self, width=50, padding=5, text=editor_field.title())
         combo = Combobox(self, width=100)
         widgets[editor_field] = {}
         widgets[editor_field]['label'] = label
         widgets[editor_field]['widget'] = combo
         label.grid(row=index, column=0)
         combo.grid(row=index, column=1)
     index += 1
     label = Label(self, width=50, padding=5, text="Pictures")
     button = Button(self, text="...", command=self.__load_pictures)
     label.grid(row=index, column=0)
     button.grid(row=index, column=1)
     return widgets
开发者ID:realmassy,项目名称:MusicLibrary,代码行数:16,代码来源:ui.py

示例6: initialize

    def initialize(self):
        """ Initialize the combobox contening all available type of filter
            and the entry text to choose the value of Q factor
        """
        self.typeCombo = Combobox(self.root, textvariable=self.typeFilter, values=F.values(), width="5")
        self.typeCombo.grid(row=1,column=self.id, padx=10)

        self.qText = Entry(self.root, textvariable=self.qFactor, width="5")
        self.qText.grid(row=2,column=self.id, padx=10, pady=5)
开发者ID:Gorgorot38,项目名称:Sonotone-RICM4,代码行数:9,代码来源:gui.py

示例7: SliderParameter

class SliderParameter(Frame):
    """
        A frame contening additionnals parameters for filter (represented by a SliderFrequency)
        to set the type and the Q factor

        parameters:
            root: Canvas
                the canvas to place the SliderParameter
            type: String
                A string representing the type of a filter
            Q: String
                the Q factor of a filter
            id: int
                ID of th SliderParameter
    """
    def __init__(self,root, type, Q, id):
        Frame.__init__(self,root)

        self.root = root
        self.typeFilter = StringVar()
        self.typeFilter.set(type)
        self.qFactor = StringVar()
        self.qFactor.set(Q)
        self.id = id

        self.initialize()

    def initialize(self):
        """ Initialize the combobox contening all available type of filter
            and the entry text to choose the value of Q factor
        """
        self.typeCombo = Combobox(self.root, textvariable=self.typeFilter, values=F.values(), width="5")
        self.typeCombo.grid(row=1,column=self.id, padx=10)

        self.qText = Entry(self.root, textvariable=self.qFactor, width="5")
        self.qText.grid(row=2,column=self.id, padx=10, pady=5)

    def getQ(self):
        """ return the value of the Q factor """
        return self.qFactor.get()

    def getType(self):
        """ Return the type of the filter """
        return self.typeCombo.get()
开发者ID:Gorgorot38,项目名称:Sonotone-RICM4,代码行数:44,代码来源:gui.py

示例8: __init__

 def __init__(self):
     f=open('degur.yaml','r',encoding='utf-8')
     self.data=yaml.load(f.read())
     f.close()
     root=Tk()
     root.wm_title('Дежурства v 0.1.1 (c) 2013-2015, Shershakov D.')
     root.geometry('{0}x{1}+0+0'.format(root.winfo_screenwidth()-10,root.winfo_screenheight()-80))
     root.rowconfigure(1,weight=1)
     root.columnconfigure(1,weight=1)
     root.columnconfigure(2,weight=1)
     f0=Frame(root)
     f1=Frame(root)
     f2=Frame(root)
     self.y=Combobox(f0,width=4)
     self.m=Combobox(f0,width=4)
     self.y.grid(row=0,column=0)
     self.m.grid(row=1,column=0)
     self.y.bind('<<ComboboxSelected>>',self.setY)
     self.m.bind('<<ComboboxSelected>>',self.setM)
     f0.grid(row=0,column=0,rowspan=10,sticky=N+S+E+W)
     f1.grid(row=1,column=1,sticky=N+S+E+W)
     f2.grid(row=1,column=2,sticky=N+S+E+W)
     self.g1=Gr(f1,self.data)
     self.g2=Gr(f2,self.data,SCRY=self.g1.scrY)
     self.set0()
     self.g1.yview2=self.g2.yview
     root.bind('<F1>',lambda e: MyHelp(root,self.data,self.y.get()))
     root.bind_all('<Control-F3>',lambda e: statistic_q(self.data,self.y.get(),v='план'))
     root.bind_all('<Shift-F3>',lambda e: statistic_q(self.data,self.y.get(),v='табель'))
     root.bind_all('<Control-F4>',lambda e: statistic(self.data,self.y.get(),v='план'))
     root.bind_all('<Shift-F4>',lambda e: statistic(self.data,self.y.get(),v='табель'))
     root.bind_all('<F3>',lambda e: statistic_q(self.data,self.y.get(),v='авто'))
     root.bind_all('<F4>',lambda e: statistic(self.data,self.y.get(),v='авто'))
     root.bind_all('<F5>',lambda e: tabel(self.data,self.y.get(),self.m.get()))
     root.bind_all('<F7>',lambda e: otp(self.data,self.y.get(),v='авто'))
     root.bind_all('<F8>',lambda e: statistic_xx(self.data,self.y.get(),v='авто'))
     root.bind_all('<F9>',lambda e: per(self.data,self.y.get(),v='авто'))
     root.bind_all('<Control-F8>',lambda e: statistic_xx(self.data,self.y.get(),v='план'))
     FreeConsole()
     root.mainloop()
开发者ID:da-sher,项目名称:degur,代码行数:40,代码来源:degur.py

示例9: __init__

 def __init__(self, *args, **kwargs):
     self._topwin  = kwargs.pop('topwin')
     super().__init__(*args, **kwargs)
     
     self.__algorithm_list = Combobox(self, value=[], takefocus=1, stat='readonly', width=12)
     self.__algorithm_list['values']   = []
     self.__algorithm_list.pack()
     self.__algorithm_list.bind('<<ComboboxSelected>>', self._on_algorithm_change)
     
     Button(self, text='Load Algorithm', command=self._on_load_algorithm).pack()
     Button(self, text='Reload', command=self._on_reload_algorithm).pack()
     
     self.name = 'Algorithms'          
开发者ID:xialulee,项目名称:WaveSyn,代码行数:13,代码来源:singlesyn.py

示例10: create_widgets

    def create_widgets(self, names):
        ''' Creates appropriate widgets.

            Args:
                names (list of str): list of available sheet names.
        '''
        sheet_name_lbl = Label(self,
                               text='Choose sheet name where data is stored:')
        sheet_name_lbl.grid(sticky=N+W, padx=5, pady=5)
        sheet_names_box = Combobox(self, state="readonly", width=20,
                                   textvariable=self.sheet_name_str,
                                   values=names)
        sheet_names_box.current(0)
        sheet_names_box.grid(row=1, column=0, columnspan=2,
                             sticky=N+W, padx=5, pady=5)
        ok_btn = Button(self, text='OK', command=self.ok)
        ok_btn.grid(row=2, column=0, sticky=N+E, padx=5, pady=5)
        ok_btn.bind('<Return>', self.ok)
        ok_btn.focus()
        cancel_btn = Button(self, text='Cancel', command=self.cancel)
        cancel_btn.grid(row=2, column=1, sticky=N+E, padx=5, pady=5)
        cancel_btn.bind('<Return>', self.cancel)
开发者ID:nishimaomaoxiong,项目名称:pyDEA,代码行数:22,代码来源:load_xls_gui.py

示例11: __init__

 def __init__(self):
     self.root=Tk()
     self.root.title('Donjon & Python-Option')
     self.root.bind('<F12>', switchDebug)
     #--------Barres de volume------#
     self.varVolumeGlobal = IntVar()
     self.varVolumeGlobal.set(Audio.volumeGlobal)
     self.varVolumeMusique = IntVar()
     self.varVolumeMusique.set(Audio.volumeMusic)
     self.varVolumeSons = IntVar()
     self.varVolumeSons.set(Audio.volumeSound)
     self.scaleVolumeGlobal = Scale(self.root,from_=0,
                                     to=100,resolution=1,
                                     orient=HORIZONTAL,
                                     length=300,width=20,
                                     label="Volume principal",
                                     tickinterval=20,
                                     variable=self.varVolumeGlobal,
                                     command = self.setVolumeGlobal)
     self.scaleVolumeMusique = Scale(self.root,from_=0,
                                     to=100,resolution=1,orient=HORIZONTAL,
                                     length=300,
                                     width=20,
                                     label="Volume Musique",
                                     tickinterval=20,
                                     variable=self.varVolumeMusique,
                                     command = self.setVolumeMusique)
     self.scaleVolumeSons = Scale(self.root,
                                     from_=0,
                                     to=100,
                                     resolution=1,
                                     orient=HORIZONTAL,
                                     length=300,
                                     width=20,
                                     label="Volume Bruitages",
                                     tickinterval=20,
                                     variable=self.varVolumeSons,
                                     command = self.setVolumeSons)
     self.scaleVolumeGlobal.set(Audio.volumeGlobal)
     self.scaleVolumeMusique.set(Audio.volumeMusic)
     self.scaleVolumeSons.set(Audio.volumeSound)
     self.scaleVolumeGlobal.pack(padx=10,pady=10)
     self.scaleVolumeMusique.pack(padx=10,pady=10)
     self.scaleVolumeSons.pack(padx=10,pady=10)
     #-----Sélection des textures----#
     Label(self.root, text='Texture Pack :').pack()
     self.box = Combobox(self.root, values=listdir('TexturePack'), state='readonly')
     self.box.bind('<<ComboboxSelected>>', self.selectionnerPack)
     self.box.current(0)
     self.box.pack()
开发者ID:Hugal31,项目名称:Donjon-Python,代码行数:50,代码来源:Options.py

示例12: _initsearchcondpanel

 def _initsearchcondpanel(self):
     frame = Frame(self)
     frame.grid(row=0, column=1, sticky=E + W + S + N, padx=5)
     
     label = Label(frame, text="Search Condition: ")
     label.grid(row=0, column=0, columnspan=1, sticky=W)
     
     relationlable = Label(frame, text="Relation")
     relationlable.grid(row=0, column=1, columnspan=1, sticky=E)
     
     self.condrelationvar = StringVar(frame)
     relationinput = Combobox(frame, textvariable=self.condrelationvar, values=["and", "or"])
     relationinput.grid(row=0, column=2, padx=5, sticky=E)
     relationinput.bind('<<ComboboxSelected>>', self._onrelationchange)
     
     self.searchcondlist = Listbox(frame)
     self.searchcondlist.grid(row=1, rowspan=1, columnspan=3, sticky=E + W + S + N)
     
     vsl = Scrollbar(frame, orient=VERTICAL)
     vsl.grid(row=1, column=3, rowspan=1, sticky=N + S + W)
     
     hsl = Scrollbar(frame, orient=HORIZONTAL)
     hsl.grid(row=2, column=0, columnspan=3, sticky=W + E + N)
     
     self.searchcondlist.config(yscrollcommand=vsl.set, xscrollcommand=hsl.set)
     
     hsl.config(command=self.searchcondlist.xview)
     vsl.config(command=self.searchcondlist.yview)
     
     newbtn = Button(frame, text="New", width=7, command=self._addsearchcondition)
     newbtn.grid(row=3, column=0, padx=5, pady=5, sticky=E)
     
     delbtn = Button(frame, text="Delete", width=7, command=self._deletesearchcondition)
     delbtn.grid(row=3, column=1, sticky=E)
     
     modbtn = Button(frame, text="Update", width=7, command=self._modifysearchcondition)
     modbtn.grid(row=3, column=2, padx=5, pady=5, sticky=W)
开发者ID:shawncx,项目名称:LogParser,代码行数:37,代码来源:logui.py

示例13: adb_Main

    def adb_Main(self):
        vcheck.auto_version_check()
        adbmain_frame = LabelFrame(self.parent, text="ADB Main function:", padx=3, pady=3)
        adbmain_frame.grid(column=0, row=2)

        check_device = Button(adbmain_frame, text="Check Device", command=lambda: adb("devices"),width=buttonw)
        check_device.pack(padx=2, pady=2)

        reboot = Button(adbmain_frame, text="Reboot", command=lambda: self.comboget(),width=buttonw)
        reboot.pack(padx=2, pady=2)

        global v
        v = StringVar()  # a string variable to hold user selection
        options = ["Normal", "Recovery", "Bootloade"]  # available combobox options
        combo = Combobox(adbmain_frame, textvariable=v, values=options, width=buttonw)
        #combo.bind('<<ComboboxSelected>>', self.comboget)  # binding of user selection with a custom callback
        combo.current(0)  # set as default "option 2"
        combo.pack()

        reboot_recovery = Button(adbmain_frame, text="Start Service", command=lambda: adb("start-server", after_print_text="Service startet"), width=buttonw)
        reboot_recovery.pack(padx=2, pady=2)

        reboot_bootloader = Button(adbmain_frame, text="Stop Service", command=lambda: adb("kill-server", after_print_text="Service Stopt"), width=buttonw)
        reboot_bootloader.pack(padx=2, pady=2)
开发者ID:mrchaosbude,项目名称:Android-Easy-Backup,代码行数:24,代码来源:Android+Easy+Backup.py

示例14: set_version_combobox

def set_version_combobox(box: ttk.Combobox, item: 'UI.Item') -> list:
    """Set values on the variant combobox.

    This is in a function so itemconfig can reuse it.
    It returns a list of IDs in the same order as the names.
    """
    ver_lookup, version_names = item.get_version_names()
    if len(version_names) <= 1:
        # There aren't any alternates to choose from, disable the box
        box.state(['disabled'])
        box['values'] = [_('No Alternate Versions!')]
        box.current(0)
    else:
        box.state(['!disabled'])
        box['values'] = version_names
        box.current(ver_lookup.index(item.selected_ver))
    return ver_lookup
开发者ID:BenVlodgi,项目名称:BEE2.4,代码行数:17,代码来源:contextWin.py

示例15: __init__

    def __init__(self, parent):
        # Dictionnaire contenant les paramètres
        self.lv_param={}
        self.lv_param['niveau'] = 5
        self.lv_param['seuil'] = 60
        self.lv_param['échantillons'] = 100

        # Initialisation et création de la fenêtre
        self.window = Toplevel(parent)
        self.window.geometry("580x160")
        self.window.title("Paramètres")
        self.window.resizable(False, False)
        self.window.protocol("WM_DELETE_WINDOW", self.valide)
        self.window.bind("<Return>", self.valide)

        Label(self.window,text="Niveau de l'algorithme",font=(FONT, 16)).pack(pady=5)

        self.frame_param = Frame(self.window)
        self.frame_param.pack(fill=BOTH, padx=10, pady=10)

        # Choix du niveau
        self.cb_lv = Combobox(self.frame_param, values=["Niveau 1", "Niveau 2", "Niveau 3", "Niveau 4", "Niveau 5", "Niveau 6"], state="readonly")
        self.cb_lv.pack(side=LEFT)
        self.cb_lv.current(4)
        self.cb_lv.bind("<<ComboboxSelected>>", self.on_cb_change)

        # Paramètres supplémentaires
        self.lb_param = Label(self.frame_param, text="")
        self.txt_param = Text(self.frame_param, height=1, width=6)
        self.txt_param.insert(END, "0")

        # Informations sur les niveaux
        self.infos_niveaux = ["Niveau 1 : Que des tirs aléatoires uniformes sans file d'attente",
                              "Niveau 2 : Tirs aléatoires uniformes et file d'attente",
                              "Niveau 3 : Tirs aléatoires sur les cases noires et file d'attente",
                              "Niveau 4 : Optimisation par des échantillons",
                              "Niveau 5 : Optimisation par nombre de bateaux local",
                              "Niveau 6 : Optimisation par énumération de tous les arrangements à partir d'un seuil"]
        frame_infos = Frame(self.window)
        frame_infos.pack(fill=X)
        self.lb_info = Label(frame_infos, justify=LEFT,  pady=5)
        self.lb_info['text'] = self.infos_niveaux[self.cb_lv.current()]
        self.lb_info.pack(side=LEFT, padx=10)

        Button(self.window, text="Valider", command=self.valide).pack(side=BOTTOM, pady=5)
开发者ID:Abunux,项目名称:pyBatNav,代码行数:45,代码来源:bn_tkinter.py


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