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


Python Combobox.bind方法代码示例

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


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

示例1: Main

# 需要导入模块: from tkinter.ttk import Combobox [as 别名]
# 或者: from tkinter.ttk.Combobox import bind [as 别名]
class Main():
    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()
    def set0(self,*e):
        Y=sorted(list(self.data.keys()))
        self.y['values']=Y
        self.y.set(Y[0])
        self.setY(*e)
    def setY(self,*e):
        M=sorted([x for x in self.data[self.y.get()] if str(x).isnumeric()])
        self.m['values']=M
        self.m.set(M[0])
        self.setM(*e)
    def setM(self,*e):
        y=self.y.get()
        m=self.m.get()
        self.g1.set(y,m)
        self.g2.set(y,m)
开发者ID:da-sher,项目名称:degur,代码行数:58,代码来源:degur.py

示例2: AlgoSelGroup

# 需要导入模块: from tkinter.ttk import Combobox [as 别名]
# 或者: from tkinter.ttk.Combobox import bind [as 别名]
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,代码行数:50,代码来源:singlesyn.py

示例3: build_combobox_with_label

# 需要导入模块: from tkinter.ttk import Combobox [as 别名]
# 或者: from tkinter.ttk.Combobox import bind [as 别名]
    def build_combobox_with_label(values, master, row, col, toggle_background_elements):
        def toggle_display():
            for element in toggle_background_elements:
                if var.get() == 'True':
                    element.configure(state='normal')
                elif var.get() == 'False':
                    element.configure(state='disabled')

        frame = Frame(master=master, bg='#FFCFC9')
        frame.grid(row=row, column=col, padx=5)
        label = Label(master=frame, text='Is logged in: ', justify=LEFT)
        label.config(justify='right', bg='white')
        label.grid(row=0, column=0, pady=2.5)
        var = StringVar(master=frame, value=values[0])
        cb = Combobox(master=frame, textvariable=var)
        cb['values'] = values
        cb.grid(row=0, column=1)
        cb.bind('<<ComboboxSelected>>', lambda x: (var.set(cb.get()), toggle_display()))
        if var.get() == 'False':
            for element in toggle_background_elements:
                element.configure(state='disabled')
        return frame, var
开发者ID:ahmadmu,项目名称:RedditRover,代码行数:24,代码来源:ConfigWizard.py

示例4: _initsearchcondpanel

# 需要导入模块: from tkinter.ttk import Combobox [as 别名]
# 或者: from tkinter.ttk.Combobox import bind [as 别名]
 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,代码行数:39,代码来源:logui.py

示例5: _popupjoincondwindow

# 需要导入模块: from tkinter.ttk import Combobox [as 别名]
# 或者: from tkinter.ttk.Combobox import bind [as 别名]
 def _popupjoincondwindow(self, index=-1):
     if index < 0:
         cond = JoinSearchCondition(("", ""))
         tofilename = ""
     else:
         condtuple = self._getselectedfile().joincondtuples[index]
         cond = condtuple[0]
         tofilename = condtuple[1]
         
     window = Toplevel(self)
     
     title = Label(window, text="New Search Condition")
     title.grid(row=0, column=0, padx=5, pady=5, sticky=W + N)
     
     filenamelabel = Label(window, text="Target Field Name: ")
     filenamelabel.grid(row=1, column=0, padx=5, pady=5, sticky=W)
     
     filevar = StringVar(window)
     filenameinput = Combobox(window, textvariable=filevar, values=self.filelist.get(0, END), width=30)
     filenameinput.grid(row=1, column=1, columnspan=2, padx=5, pady=5, sticky=W)
     
     fromfieldlabel = Label(window, text="Field in From File: ")
     fromfieldlabel.grid(row=3, column=0, padx=5, pady=5, sticky=W)
     
     fromfields = csvhandler.getfields(self._getselectedfile().filename)
     fromfieldvar = StringVar(window)
     fieldinput = Combobox(window, textvariable=fromfieldvar, values=fromfields, width=20)
     fieldinput.grid(row=3, column=1, columnspan=2, padx=5, pady=5, sticky=W)
     
     tofieldlabel = Label(window, text="Field in Target File: ")
     tofieldlabel.grid(row=4, column=0, padx=5, pady=5, sticky=W)
     
     tofields = []
     tofieldvar = StringVar(window)
     tofieldinput = Combobox(window, textvariable=tofieldvar, values=tofields, width=20)
     tofieldinput.grid(row=4, column=1, columnspan=2, padx=5, pady=5, sticky=W)
     
     def updatetofieldinput(evt):
         if filevar.get() is not None and len(filevar.get()) > 0:
             tofields = csvhandler.getfields(filevar.get())
             window.grid_slaves(4, 1)[0].grid_forget()
             tofieldinput = Combobox(window, textvariable=tofieldvar, values=tofields, width=20)
             tofieldinput.grid(row=4, column=1, columnspan=2, padx=5, pady=5, sticky=W)
     
     filenameinput.bind('<<ComboboxSelected>>', updatetofieldinput)
     
     # init value
     filevar.set(tofilename)
     fromfieldvar.set(cond.fieldtuple[0])
     updatetofieldinput(None)
     tofieldvar.set(cond.fieldtuple[1])
     
     def _newcond():
         '''create new condition
         '''
         cond = JoinSearchCondition((fromfieldvar.get(), tofieldvar.get()))
         tofilename = filevar.get()
         
         selectedfile = self._getselectedfile()
         if index < 0:
             selectedfile.joincondtuples.append((cond, tofilename))
             
         else:
             del selectedfile.joincondtuples[index]
             selectedfile.joincondtuples[index:index] = [(cond, tofilename)]
             
         self._inflatejoincondlist(selectedfile.joincondtuples)
         
         window.destroy()
     
     okbtn = Button(window, text="Confirm", width=7, command=_newcond)
     okbtn.grid(row=6, column=1, rowspan=1, columnspan=1, sticky=E, padx=5, pady=5)
     
     clsbtn = Button(window, text="Close", width=7, command=lambda: window.destroy())
     clsbtn.grid(row=6, column=2, rowspan=1, columnspan=1, sticky=W, padx=5, pady=5)
开发者ID:shawncx,项目名称:LogParser,代码行数:77,代码来源:logui.py

示例6: SimUI

# 需要导入模块: from tkinter.ttk import Combobox [as 别名]
# 或者: from tkinter.ttk.Combobox import bind [as 别名]

#.........这里部分代码省略.........
            value=self.manager.MODE_OPERATOR_CONTROL,
            command=_set_mode,
        )
        button.pack(fill=tk.X)
        self.state_buttons.append(button)

        button = tk.Radiobutton(
            sim,
            text="Test",
            variable=self.mode,
            value=self.manager.MODE_TEST,
            command=_set_mode,
        )
        button.pack(fill=tk.X)
        self.state_buttons.append(button)

        self.robot_dead = tk.Label(sim, text="Robot died!", fg="red")

        sim.pack(side=tk.TOP, fill=tk.BOTH, expand=1)

        #
        # Set up a combo box that allows you to select an autonomous
        # mode in the simulator
        #

        try:
            from tkinter.ttk import Combobox
        except:
            pass
        else:
            auton = tk.LabelFrame(ctrl_frame, text="Autonomous")

            self.autobox = Combobox(auton, state="readonly")
            self.autobox.bind("<<ComboboxSelected>>", self.on_auton_selected)
            self.autobox["width"] = 12
            self.autobox.pack(fill=tk.X)

            Tooltip.create(
                self.autobox,
                "Use robotpy_ext.autonomous.AutonomousModeSelector to use this selection box",
            )

            from networktables.util import ChooserControl

            self.auton_ctrl = ChooserControl(
                "Autonomous Mode",
                lambda v: self.idle_add(self.on_auton_choices, v),
                lambda v: self.idle_add(self.on_auton_selection, v),
            )

            auton.pack(side=tk.TOP)

            messages = self.config_obj["pyfrc"]["game_specific_messages"]
            if messages:

                gamedata = tk.LabelFrame(ctrl_frame, text="Game Data")

                self.gamedataval = tk.StringVar()
                if hasattr(self.gamedataval, "trace_add"):
                    self.gamedataval.trace_add("write", self.on_gamedata_selected)
                else:
                    self.gamedataval.trace_variable("w", self.on_gamedata_selected)

                self.gamedatabox = Combobox(gamedata, textvariable=self.gamedataval)
                self.gamedatabox["width"] = 12
                self.gamedatabox.pack(fill=tk.X)
开发者ID:robotpy,项目名称:pyfrc,代码行数:70,代码来源:ui.py

示例7: Menu

# 需要导入模块: from tkinter.ttk import Combobox [as 别名]
# 或者: from tkinter.ttk.Combobox import bind [as 别名]
helpmenu = Menu(menubar, tearoff=0)
helpmenu.add_command(label="Help Index", command=donothing)
helpmenu.add_command(label="About...", command=about)
menubar.add_cascade(label="Help", menu=helpmenu)

root.config(menu=menubar)

filebox = Combobox(root, textvariable=filevar, values=openfiles, state='readonly')
filebox.current(0)
colorbox = Combobox(root, textvariable=colorvar, values=colors, state='readonly')
colorbox.current(0)
label1 = Label(root, textvariable = mode, bg="white", fg="black")
label3 = Label(root, text="vakant", bg="white", fg="black")

draw = Canvas(root, cursor="none", width=WidthHeight[0], height=WidthHeight[1])
draw.bind("<Motion>", functools.partial(motion, objects1=objects, keyes1=keyes, new1=new, arc=arc, WidthHeight=WidthHeight , color=color))
draw.bind("<Button-1>", functools.partial(paint, keyes1=keyes, snapp1=snapp, new1=new, arc=arc))
draw.bind_all("<KeyPress>",  keypressed)
filebox.bind("<<ComboboxSelected>>", fileop.changeactive)
colorbox.bind("<<ComboboxSelected>>", fileop.colorset)


filebox.grid(row=0, column=0, columnspan=1, sticky=W+E)
colorbox.grid(row=0, column=1, columnspan=1, sticky=W+E)
draw.grid(row=1, column=0, columnspan=10, sticky=W+E)
label1.grid(row=2, column=0, columnspan=1, sticky=W+E)
label3.grid(row=2, column=2, columnspan=8, sticky=W+E)

root.mainloop()
开发者ID:Ranjan13,项目名称:GeoCAD,代码行数:31,代码来源:tkinter_Gui_cad_14_OOP.py

示例8: AppGUI

# 需要导入模块: from tkinter.ttk import Combobox [as 别名]
# 或者: from tkinter.ttk.Combobox import bind [as 别名]
class AppGUI(Frame):
    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()

    def _send_mail(self):
        if not self.lock:
            threading.Thread(target=self.__send_mail).start()
        else:
            messagebox.showinfo('Warning', "Now it's processing...")

    def _choose(self, event):
        # arr = self.url_lang_link.get(self.url_lang_combobox_str.get())  # Get the array by choosing language.
        pass

    def _modify_content_url_link(self):
        link_arr = self.url_lang_link.get(self.url_lang_combobox_str.get())
        content = self._mailer.content
        for index in range(len(link_arr)):
            content_index = content.index(self.url_lang_link_title[index]) + len(self.url_lang_link_title[index])
            content = content[:content_index] + '\n' + link_arr[index] + content[content_index:]

        self._mailer.content = content
        return False

    def _make_mailer(self):
        self.mail_attachment_list = attachment_list[:]  # Clone a list.
        if atta_lang_list[self.url_lang_combobox.current()]:
            for i in range(len(self.mail_attachment_list)):
                # Only from the third file to the end file can change language.
                if i > 2:
                    # Modify the file name.
                    att = self.mail_attachment_list[i].split('.')
                    self.mail_attachment_list[i] = ''.join([' ', atta_lang_list[self.url_lang_combobox.current()], '.']).join(att)

        # ** IMPORTANT, we set the content path here!!
        path = 'content.docx'
        if self.url_lang_combobox.get() == lang_list[2] or self.url_lang_combobox.get() == lang_list[3]:
            path = 'content chinese.docx'
        if debug_log:
            print(self.mail_attachment_list)

        # ** IMPORTANT, we have to new an object here. Otherwise, we couldn't check the error checking.
        return Mailer(content_path=path, attachment_list=self.mail_attachment_list)

    def __create_widgets(self):
        """
        Construct all of the UI components.
        """

        self.receiver_email_text.grid(row=0, column=0)
        self.receiver_email_field.grid(row=0, column=1, columnspan=6)
        self.subject_text.grid(row=1, column=0)
        self.subject_field.grid(row=1, column=1, columnspan=6)
        self.subject_field.insert(0, 'Osaka Mariko Apartment Location & Condition')
        self.receiver_name_text.grid(row=2, column=0)
        self.receiver_name_field.grid(row=2, column=1, columnspan=6)
        self.url_lang_text.grid(row=3, column=0)
        self.url_lang_combobox.grid(row=3, column=2, columnspan=2)
        self.send_progressbar.grid(row=4, column=0, columnspan=7)
        self.send_button.grid(row=5, column=2)
        self.quit_button.grid(row=5, column=3)
        self.log_msg_text.grid(row=6, column=0, columnspan=7)

        # Default setting.
        self.url_lang_combobox.current(0)
        self.url_lang_combobox.bind("<<ComboboxSelected>>", self._choose)

    def __exit(self):
#.........这里部分代码省略.........
开发者ID:pokk,项目名称:Mailer,代码行数:103,代码来源:auto_mailer.py

示例9: makeentry

# 需要导入模块: from tkinter.ttk import Combobox [as 别名]
# 或者: from tkinter.ttk.Combobox import bind [as 别名]
def makeentry(parent, caption, width=None, **options):
    Label(parent, text=caption).pack(side=LEFT)
    entry = Entry(parent, **options)
    if width:
        entry.config(width=width)
    entry.pack(side=LEFT)
    return entry
#
# user = makeentry(root, "User name:", 10)
# password = makeentry(root, "Password:", 10, show="*")
#
# def login_clicked():
#     print(user.get(), password.get())
#
# login = Button(root, text="Login", command=login_clicked, height="5")
# login.pack(fill=BOTH) # îòîáðàçèòü íà îêíå

def set(*args):
    print(combo.get())
    e.delete(0, END)
    e.insert(0, combo.get())

combo = Combobox(root, values=['1', '2', '3'], state='readonly')
combo.bind('<<ComboboxSelected>>', set)
combo.pack()


root.protocol('WM_DELETE_WINDOW', close) # çàêðîåòñÿ ïðèëîæåíèå ïî çàêðûòèþ îêíà

root.mainloop() # çàïóñêàåì ïðîãðàììó
开发者ID:ginbeard,项目名称:HomeworkStorage,代码行数:32,代码来源:TKmodule.py

示例10: Gr

# 需要导入模块: from tkinter.ttk import Combobox [as 别名]
# 或者: from tkinter.ttk.Combobox import bind [as 别名]
class Gr():
    def __init__(self,root,data,SCRY=None):
        self.data=data
        self.columns=[x for x in range(1,8)]+['day']
        root.rowconfigure(1,weight=1)
        root.columnconfigure(0,weight=1)
        root.columnconfigure(1,weight=1)
        root.columnconfigure(2,weight=1)
        f=Frame(root)
        f.columnconfigure(0,weight=1)
        f.rowconfigure(1,weight=1)
        self.v=Combobox(root)
        self.v.grid(row=0,column=0)
        self.v.bind('<<ComboboxSelected>>',self.select_ver)
        f.grid(row=1,column=0,columnspan=3,sticky=N+S)
        self.tree=Treeview(f,
                columns=self.columns,
                displaycolumns=['day']+self.columns[:-1],
                show='headings')
        #self.tree.tag_configure('odd',background='white')
        #self.tree.tag_configure('even',background='gray')
        self.tree.tag_configure('dif',foreground='brown')
        self.tree.tag_configure('work',background='white')
        self.tree.tag_configure('short',background='#F5EFE0')
        self.tree.tag_configure('rest',background='#E0B0B0')
        self.tree.tag_configure('holyday',background='#E7B7A4')
        for c in self.columns:
            self.tree.heading(c,text=c)
            self.tree.column(c,width=65,anchor='center')
        self.tree.column('day',width=30)
        scrX=Scrollbar(f,orient='horizontal',command=self.tree.xview)
        self.tree['xscrollcommand']=scrX.set
        if not SCRY:
            self.scrY=Scrollbar(f,orient='vertical',command=self.yview)
            self.tree['yscrollcommand']=self.scrY.set
        else:
            self.tree['yscrollcommand']=SCRY.set
        self.tree.grid(row=1,column=0,sticky=N+S)
        if not SCRY:
            self.scrY.grid(row=1,column=1,sticky=N+S)
        scrX.grid(row=2,column=0,sticky=E+W)
    def set(self,y,m):
        self.y=y
        self.m=m
        self.show()
    def yview(self,*args):
        self.tree.yview(*args)
        self.yview2(*args)
    def yview2(self,*args):
        pass
    def show(self):
        d=self.data[self.y][self.m]
        V=list(d['degur'].keys())
        self.v['values']=V
        self.v.set(V[0])
        self.select_ver()
    def select_ver(self,*e):
        self.tree.delete(*self.tree.get_children())
        d=self.data[self.y][self.m]
        offset=d['offset']
        v=self.v.get()
        col=[]
        for i,deg in enumerate(d['degurs']):
            self.tree.heading(i+1,text=deg)
            col.append(i+1)
        self.tree.configure(displaycolumns=['day']+col)
        items=dict()

        if 'табель' in d['degur']:
            a=[''.join(x) for x in zip(*[[x for x in d['degur']['план'][j]] \
                    for j in d['degurs']])]
            b=[''.join(x) for x in zip(*[[x for x in d['degur']['табель'][j]] \
                    for j in d['degurs']])]
            c=[x!=y for x,y  in zip(a,b)]
        else:
            c=[False]*32

        for i in range(1,d['days']+1):
            tag = (i+offset) % 7 in [0,6] and 'rest' or 'work'
            if i in d['holydays'] : tag='holyday'
            elif i in d['restdays'] : tag='rest'
            elif i in d['shortdays'] : tag='short'
            elif i in d['workdays'] : tag='work'
            if c[i]: tag=[tag,'dif']
            ii=self.tree.insert('','end',values=['-','-','-','-','-'],tag=tag)
            self.tree.set(ii,column='day',value=i)
            items[i]=ii

        
        for j,s in d['degur'][v].items(): # j-degur
            if not s: continue
            for i,val in enumerate(s[1:-1]):
                if val=='J':
                    val='до'
                elif val=='j':
                    val='од'
                elif val=='a':
                    val='10'
                self.tree.set(items[i+1],column=d['degurs'].index(j)+1,value=val)
            if s[0]=='Н':
#.........这里部分代码省略.........
开发者ID:da-sher,项目名称:degur,代码行数:103,代码来源:degur.py

示例11: __init__

# 需要导入模块: from tkinter.ttk import Combobox [as 别名]
# 或者: from tkinter.ttk.Combobox import bind [as 别名]
class FenOptions:
    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()
    def selectionnerPack(self, event) :
        global texturePack
        texturePack = self.box.get()
    def run(self):
        self.root.mainloop()
        Audio.volumeGlobal = volume
        Audio.setVolumeMusic()
    def setVolumeGlobal(self, volume):
        Audio.volumeGlobal = volume
        Audio.setVolumeMusic()
    def setVolumeMusique(self, volume):
        Audio.volumeMusic = volume
        Audio.setVolumeMusic()
    def setVolumeSons(self, volume):
        Audio.volumeSound = volume
开发者ID:Hugal31,项目名称:Donjon-Python,代码行数:68,代码来源:Options.py

示例12: reactToClick

# 需要导入模块: from tkinter.ttk import Combobox [as 别名]
# 或者: from tkinter.ttk.Combobox import bind [as 别名]
class OptimizerMainWindow:
    """
    classdocs
    """

    # TODO: change that name
    def reactToClick(self, event):
        a = AddRestrictionDialog(self)

    def __init__(self, optimizer):

        # always have a reference to model/controller
        self.optimizer = optimizer

        # setup main GUI and make stretchable
        self.guiRoot = Tk()
        self.guiRoot.title("OPTIMIZR")
        self.guiRoot.columnconfigure(1, weight=1)
        self.guiRoot.rowconfigure(0, weight=1)

        # left (settings) and right (sequences) part
        self.frameLeft = Frame(self.guiRoot)
        self.frameLeft.grid(row=0, column=0, sticky=W + E + N + S)
        self.frameLeft.columnconfigure(0, weight=1)
        self.frameRight = Frame(self.guiRoot)
        self.frameRight.grid(row=0, column=1, sticky=W + E + N + S)
        self.frameRight.columnconfigure(0, weight=1)
        self.frameRight.rowconfigure(0, weight=1)
        self.frameRight.rowconfigure(1, weight=1)

        self.frameSpeciesControll = LabelFrame(self.frameLeft, text="Species", pady=10, padx=10)
        self.frameSpeciesControll.columnconfigure(1, weight=1)
        self.frameOptimizationControll = LabelFrame(self.frameLeft, text="Optimization", pady=10, padx=10)
        self.frameRestrictionControll = LabelFrame(self.frameLeft, text="Restriction Enzymes", pady=10, padx=10)
        self.frameSpeciesControll.grid(row=0, column=0, sticky=W + E, padx=10, pady=10)
        self.frameOptimizationControll.grid(row=1, column=0, sticky=W + E, padx=10, pady=10)
        self.frameRestrictionControll.grid(row=2, column=0, sticky=W + E, padx=10, pady=10)

        # Species Controll
        Label(self.frameSpeciesControll, text="Source:").grid(row=0, column=0)
        Label(self.frameSpeciesControll, text="Target:").grid(row=1, column=0)

        self.comboSourceSpecies = Combobox(self.frameSpeciesControll, state="readonly")
        self.comboSourceSpecies.grid(row=0, column=1, pady=5, sticky="ew")
        self.comboTargetSpecies = Combobox(self.frameSpeciesControll, state="readonly")
        self.comboTargetSpecies.grid(row=1, column=1, pady=5, sticky="we")
        self.buttonSpeciesList = Button(self.frameSpeciesControll, text="Edit Species List")
        self.buttonSpeciesList.grid(row=2, column=1, pady=5, sticky="e")

        self.comboSourceSpecies.bind("<<ComboboxSelected>>", self.actionOptimizerSettingsChanged)
        self.comboTargetSpecies.bind("<<ComboboxSelected>>", self.actionOptimizerSettingsChanged)

        # Optimization Controll
        Label(self.frameOptimizationControll, text="Optimization Strategy:").grid(row=0, column=0)
        self.comboOptimizationStrategy = Combobox(self.frameOptimizationControll, state="readonly")
        self.comboOptimizationStrategy.grid(row=0, column=1)
        self.comboOptimizationStrategy["values"] = self.optimizer.possibleOptimizationStrategies
        self.comboOptimizationStrategy.bind("<<ComboboxSelected>>", self.actionOptimizerSettingsChanged)

        # Restriction Enzymes
        self.listRestriction = Listbox(self.frameRestrictionControll)
        self.listRestriction.grid(row=0, column=0, columnspan=3, pady=5, sticky=W + E)
        self.frameRestrictionControll.columnconfigure(0, weight=1)
        self.buttonRestricionAdd = Button(self.frameRestrictionControll, text=" + ")
        self.buttonRestricionDel = Button(self.frameRestrictionControll, text=" - ")
        self.buttonRestricionAdd.grid(row=1, column=1, padx=5)
        self.buttonRestricionDel.grid(row=1, column=2, padx=5)

        # Source Sequence Frame
        self.frameSourceSequence = LabelFrame(self.frameRight, text="Source Sequence", padx=10, pady=10)
        self.frameResultSequence = LabelFrame(self.frameRight, text="Result Sequence", padx=10, pady=10)
        self.frameSourceSequence.grid(row=0, column=0, sticky="wens", padx=10, pady=10)
        self.frameResultSequence.grid(row=1, column=0, sticky="wens", padx=10, pady=10)

        self.buttonSourceLoad = Button(self.frameSourceSequence, text=" Load ")
        self.textSourceSeq = ScrolledText(self.frameSourceSequence, height=10)
        self.buttonSourceLoad.grid(row=0, column=1, sticky="e", pady=5)
        self.textSourceSeq.grid(row=1, column=0, columnspan=2, sticky="wens")
        self.frameSourceSequence.columnconfigure(0, weight=1)
        self.frameSourceSequence.rowconfigure(1, weight=1)
        self.textSourceSeq.frame.columnconfigure(1, weight=1)
        self.textSourceSeq.frame.rowconfigure(0, weight=1)

        self.buttonOptimize = Button(self.frameResultSequence, text=" OPTIMIZE! ")
        self.buttonOptimize.bind("<ButtonRelease>", self.actionOptimize)

        self.buttonRemoveRestriction = Button(self.frameResultSequence, text=" RESTRICTION-B-GONE! ")
        self.buttonRemoveRestriction.bind("<ButtonRelease>", self.actionRemoveRestricion)

        self.buttonSaveResult = Button(self.frameResultSequence, text=" Save ")
        self.textResultSequence = ScrolledText(self.frameResultSequence, height=10)
        self.buttonOptimize.grid(column=0, row=0, pady=5, sticky="w")
        self.buttonRemoveRestriction.grid(column=1, row=0, pady=5, padx=10, sticky="w")
        self.textResultSequence.grid(row=1, column=0, columnspan=4, sticky="wens")
        self.buttonSaveResult.grid(row=2, column=3, pady=5, sticky="e")
        self.frameResultSequence.columnconfigure(2, weight=1)
        self.frameResultSequence.rowconfigure(1, weight=1)
        self.textResultSequence.frame.columnconfigure(1, weight=1)
        self.textResultSequence.frame.rowconfigure(0, weight=1)

#.........这里部分代码省略.........
开发者ID:hoerldavid,项目名称:codonoptimizer,代码行数:103,代码来源:OptimizerMainWindow.py

示例13: cbox_do

# 需要导入模块: from tkinter.ttk import Combobox [as 别名]
# 或者: from tkinter.ttk.Combobox import bind [as 别名]
from tkinter import *
from tkinter.ttk import Combobox

def cbox_do(event):
    'Used for cbox.'
    clabel.config(text=cbox.get())

a = Tk()
cbox = Combobox(a, value=('Luke','Biggs','Wedge'), takefocus=0)
cbox.bind("<<ComboboxSelected>>", cbox_do)
cbox.pack()
clabel = Label(a)
clabel.pack()
a.mainloop()

master = Tk()
variable = StringVar(master)
variable.set("one")
w = Combobox(master, textvariable=variable, values=["one", "two", "three"])
w.pack()

master.mainloop()
开发者ID:guochangjiang,项目名称:Python.learn,代码行数:24,代码来源:tk.draw.down.box3.py

示例14: run_with_gui

# 需要导入模块: from tkinter.ttk import Combobox [as 别名]
# 或者: from tkinter.ttk.Combobox import bind [as 别名]
def run_with_gui():
    root = Tk()
    root.title("PyEncConv")

    def browse_in():
        name = askopenfilename()
        if name:
            in_txt.delete(0, END)
            in_txt.insert(END, name)

    def browse_out():
        name = asksaveasfilename()
        if name:
            out_txt.delete(0, END)
            out_txt.insert(END, name)

    # input file
    f = Frame(root)
    f.pack(anchor=W, fill=X)
    Label(f, text="input file:").pack(side=LEFT)
    in_txt = Entry(f)
    in_txt.pack(fill=X, expand=True, side=LEFT)
    in_browse = Button(f, text="browse...", command=browse_in)
    in_browse.pack(side=LEFT)

    def load_file():
        try:
            txt_area.delete(1.0, END)
            in_enc = in_enc_cmb.get()
            in_alias_lbl.config(text=(' '.join(get_alt_names(in_enc))))

            with open(in_txt.get(), 'r', encoding=in_enc) as f:
                txt_area.insert(END, f.read())
        except IOError as e:
            txt_area.insert(END, str(e))
        except OSError as e:
            txt_area.insert(END, str(e))
        except LookupError as e:
            txt_area.insert(END, str(e))
        except Exception as e:
            txt_area.insert(END, str(e))

    # input encoding
    f = Frame(root)
    f.pack(anchor=W, fill=X)
    Label(f, text="input encoding:").pack(side=LEFT)
    in_enc_cmb = Combobox(f)
    in_enc_cmb.pack(side=LEFT)
    in_enc_cmb['values'] = enc_set
    in_enc_cmb.insert(END, getpreferredencoding())
    in_enc_cmb.bind('<Return>', lambda event:load_file())
    in_alias_lbl = Label(f)
    in_alias_lbl.pack(side=LEFT)

    Button(root, text="Load for preview", command=load_file).pack(anchor=W)

    def disable_output_file():
        out_txt.config(state=DISABLED)
        out_browse.config(state=DISABLED)

    def enable_output_file():
        out_txt.config(state=NORMAL)
        out_browse.config(state=NORMAL)

    # output file
    out_choice = IntVar(value=1)
    Radiobutton(root, text="overwrite original (after moving to .bak)",
            variable = out_choice, value=1,
            command=disable_output_file).pack(anchor=W)
    f = Frame(root)
    f.pack(anchor=W, fill=X)
    Radiobutton(f, text="output file:",
            variable = out_choice, value=2,
            command=enable_output_file).pack(side=LEFT)
    out_txt = Entry(f, state=DISABLED)
    out_txt.pack(fill=X, expand=True, side=LEFT)
    out_browse = Button(f, text="browse...", command=browse_out,
            state=DISABLED)
    out_browse.pack(side=LEFT)

    # output encoding
    f = Frame(root)
    f.pack(anchor=W, fill=X)
    Label(f, text="output encoding:").pack(side=LEFT)
    out_enc_cmb = Combobox(f)
    out_enc_cmb.pack(side=LEFT)
    out_enc_cmb['values'] = enc_set
    out_enc_cmb.insert(END, 'UTF-8')
    out_alias_lbl = Label(f)
    out_alias_lbl.pack(side=LEFT)

    def convert():
        try:
            txt_area.delete(1.0, END)
            in_enc = in_enc_cmb.get()
            in_alias_lbl.config(text=(' '.join(get_alt_names(in_enc))))
            out_enc = out_enc_cmb.get()
            out_alias_lbl.config(text=(' '.join(get_alt_names(out_enc))))

            src_file = in_txt.get()
#.........这里部分代码省略.........
开发者ID:lululeta2014,项目名称:mihaib,代码行数:103,代码来源:gui.py

示例15: __init__

# 需要导入模块: from tkinter.ttk import Combobox [as 别名]
# 或者: from tkinter.ttk.Combobox import bind [as 别名]
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        timer = TkTimer(widget=self, interval=200, active=False)
        
        self.__battery_images = battery_images = {}
        image_dir = Path(Scripting.root_node.get_gui_image_path('battery'))
        for image_name in ['10per', '25per', '50per', '75per', '100per',
                           '10per_charge', '25per_charge', 
                           '50per_charge', '75per_charge', '100per_charge']:
            battery_images[image_name] = ImageTk.PhotoImage(
                file=str(image_dir/(image_name+'.png')))
            
        self.__busy_images = busy_images = {}
        image_dir = Path(Scripting.root_node.get_gui_image_path('busysignal'))
        busy_images['busy'] = ImageTk.PhotoImage(file=str(image_dir/('busy'+'.png')))
        busy_images['available'] = ImageTk.PhotoImage(file=str(image_dir/('available'+'.png')))

        balloon = Scripting.root_node.gui.balloon
                        
        self.__busy_lamp = busy_lamp = Label(self)
        busy_lamp['image'] = busy_images['available']
        busy_lamp.pack(side='right', fill='y')
        
        balloon.bind_widget(busy_lamp, balloonmsg='''Main-thread status.
Green: main-thread is available;
Red:   main-thread is busy.''')
        
        battery_meter = Label(self)
        battery_meter.pack(side='right', fill='y')
        battery_meter_tip = balloon.bind_widget(battery_meter, balloonmsg='Battery: ')
        def battery_meter_tip_show_callback():
            battery_status = Scripting.root_node.interfaces.os.get_battery_status()
            if battery_status is None:
                return 'No battery detected.'
            else:
                return f'{battery_status.percent}%'
        battery_meter_tip.show_callback = battery_meter_tip_show_callback
        
        self.__membar = IntVar(0)
        self.__cpubar = IntVar(0)
        self._make_cpu_mem_status()

        # Transparent Scale {
        def on_scale(val):
            Scripting.root_node.gui.console.set_opacity(val)
        trans_scale = Scale(self, from_=0.2, to=1.0, orient='horizontal', value=1, command=on_scale)
        trans_scale.pack(side='right')
        balloon.bind_widget(trans_scale, balloonmsg='Set the opacity of the console.')
        # } End Transparent Scale

        # Topmost Button {
        import tkinter
        topmost_button = tkinter.Button(self, text='TOP', relief='groove') 
        topmost_button.pack(side='right')
        
        def on_click():
            console =Scripting.root_node.gui.console
            b = console.is_topmost
            fg = 'black' if b else 'lime green'
            topmost_button['fg'] = fg
            with code_printer(True):
                console.set_topmost(not b)
            
        topmost_button['command'] = on_click
        balloon.bind_widget(topmost_button, balloonmsg='Set the console as a topmost window.')
        # } End Topmost Button 
        
        # Doc Button {
        docbtn = tkinter.Button(self, text='DOC', relief='groove')
        docbtn.pack(side='right')
        
        def on_click():
            docwin = Scripting.root_node.gui.console.doc_window
            with code_printer(True):
                docwin.show_window()
                
        docbtn['command'] = on_click
        balloon.bind_widget(docbtn, balloonmsg='Show document window.')
        #} End Doc Window        
        
        # Debug Button {
        debbtn = tkinter.Button(self, text='DEB', relief='groove')
        debbtn.pack(side='right')
        
        def on_click():
            debwin = Scripting.root_node.gui.console.debug_window
            with code_printer(True):
                debwin.show_window()
                
        debbtn['command'] = on_click
        balloon.bind_widget(debbtn, balloonmsg='Show debug window.')
        #} End Debug Button
        
        #{ Window Combo
        window_combo = Combobox(self, value=[], takefocus=1, stat='readonly')
        def on_selected(event):
            text = event.widget.get()
            wid = int(text.split(':')[1].strip())
            Scripting.root_node.gui.windows[wid].tk_object.deiconify()
        window_combo.bind('<<ComboboxSelected>>', on_selected)
#.........这里部分代码省略.........
开发者ID:xialulee,项目名称:WaveSyn,代码行数:103,代码来源:console.py


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