本文整理汇总了Python中tkinter.ttk.Combobox类的典型用法代码示例。如果您正苦于以下问题:Python Combobox类的具体用法?Python Combobox怎么用?Python Combobox使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Combobox类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: createWidgets
def createWidgets(self):
self.function_label = Label(self)
self.function_label["text"] = "Задати функцію"
self.function_label.grid(row=0, column=0)
self.function_combo = Combobox(self)
self.function_combo["values"] = ["x*x", "cos(x)"]
self.function_combo.set("x*x")
self.function_combo.grid(row=0, column=1)
self.a_label = Label(self)
self.a_label["text"] = "Задати ліву межу"
self.a_label.grid(row=1, column=0)
self.a = Entry(self)
self.a.insert(END, '0')
self.a.grid(row=1, column=1)
self.b_label = Label(self)
self.b_label["text"] = "Задати праву межу"
self.b_label.grid(row=2, column=0)
self.b = Entry(self)
self.b.insert(END, '50')
self.b.grid(row=2, column=1)
self.learning_button = Button(self)
self.learning_button["text"] = "Навчити"
self.learning_button["command"] = self.make_points
self.learning_button.grid(row=3, column=0)
self.check_button = Button(self)
self.check_button["text"] = "Розпізнати"
self.check_button["command"] = self.check
self.check_button.grid(row=3, column=1)
self.learn_canvas = Canvas(self)
self.learn_canvas.grid(row=4, column=0)
self.check_canvas = Canvas(self)
self.check_canvas.grid(row=4, column=1)
开发者ID:Olenatko,项目名称:DYPLOM,代码行数:41,代码来源:main.py
示例17: _makesetting
def _makesetting(setting_window, conf):
setting_label = Label(setting_window,
text=_('Setting'),
font=('courier', 20, 'bold'))
setting_label.pack(side=TOP)
style_container = Frame(setting_window)
style_container.pack(side=TOP)
style_label = Label(style_container,
text=_('Display wallpaper in style: '),
font=('courier', 15, 'bold'))
style_label.pack(side=LEFT)
style_combobox = Combobox(style_container)
available_style = {'3': 'zoom', '2': 'scaled', '1': 'stretched', '0': 'centered', '4': 'wallpaper'}
style_combobox['value'] = (_('centered'), _('stretched'), _('scaled'), _('zoom'), _('wallpaper'))
style_combobox.state(['readonly'])
style_combobox.current(int(conf['style']))
style_combobox.pack(side=LEFT)
random_container = Frame(setting_window)
random_container.pack(side=TOP)
random_label = Label(random_container,
text=_('Choose wallpaper randomly? '),
font=('courier', 15, 'bold'))
random_label.pack(side=LEFT)
random_checkbutton = Checkbutton(random_container)
random_checkbutton.pack(side=LEFT)
if conf['random'] == "1":
random_checkbutton.select()
interval_container = Frame(setting_window)
interval_container.pack(side=TOP)
interval_label = Label(interval_container,
text=_('Change wallpaper every '),
font=('courier', 15, 'bold'))
interval_label.pack(side=LEFT)
interval_text = Text(interval_container, height=1, width=4)
interval_text.insert(END, conf['interval'])
interval_text.pack(side=LEFT)
minute_label = Label(interval_container,
text=_(' minutes.'),
font=('courier', 15, 'bold'))
minute_label.pack(side=LEFT)
开发者ID:funagi,项目名称:wallpapoz,代码行数:43,代码来源:wallpapoz_main_window.py
示例18: body
def body(self, frame):
"Place panel widgets"
frame.grid_columnconfigure(0, weight=1)
frame.grid_rowconfigure(1, weight=1)
top = Frame(frame)
top.grid(column=0, row=0, sticky="ew")
self.mounts = Combobox(top, takefocus=False, state="readonly")
self.mounts["postcommand"] = self.get_places
self.mounts.bind("<<ComboboxSelected>>", self.goto_place)
self.mounts.pack(anchor="nw")
pthl = Label(top, textvariable=self.pwd)
pthl.pack(expand=True, anchor="w")
self.tree = tree = Treeview(frame,
columns=("size", "modified", "mode"))
tree.grid(column=0, row=1, sticky="nwes")
vsb = Scrollbar(frame, command=self.tree.yview, orient="vertical")
vsb.grid(column=1, row=1, sticky="ns")
tree["yscrollcommand"] = lambda f, l: autoscroll(vsb, f, l)
hsb = Scrollbar(frame, command=self.tree.xview,
orient="horizontal")
hsb.grid(column=0, row=2, sticky="ew")
tree["xscrollcommand"] = lambda f, l: autoscroll(hsb, f, l)
tree.column("size", width=70, anchor="center")
tree.column("modified", width=70, anchor="center")
tree.column("mode", width=70, anchor="center")
tree.heading("#0", command=lambda: self.on_heading("name"))
tree.heading("size", command=lambda: self.on_heading("size"))
tree.heading("modified", command=lambda: self.on_heading("date"))
tree.tag_configure("selected", foreground="red")
for i in (("<Return>", self.enter_file),
("<Double-Button-1>", self.enter_file),
("<Right>", self.enter_file), ("<Left>", self.go_back),
("<Tab>", self.switch), ("<Home>", self.go_top),
("<Button-1>", self.activate),
("<Insert>", self.turn_selection),
("<Control-r>", self.refresh)):
tree.bind(*i)
开发者ID:Lysovenko,项目名称:bpc,代码行数:37,代码来源:panel.py
示例19: build_combobox_with_label
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,代码行数:22,代码来源:ConfigWizard.py
示例20: _setup_widgets
#.........这里部分代码省略.........
ctrl_frame = tk.Frame(bottom)
# timing control
timing_control = tk.LabelFrame(ctrl_frame, text="Time")
def _set_realtime():
if realtime_mode.get() == 0:
step_button.pack_forget()
step_entry.pack_forget()
self.on_pause(False)
else:
step_button.pack(fill=tk.X)
step_entry.pack()
self.on_pause(True)
realtime_mode = tk.IntVar()
button = tk.Radiobutton(timing_control, text="Run", variable=realtime_mode, value=0, command=_set_realtime)
button.pack(fill=tk.X)
button = tk.Radiobutton(timing_control, text="Pause", variable=realtime_mode, value=1, command=_set_realtime)
button.pack(fill=tk.X)
step_button = tk.Button(timing_control, text="Step", command=self.on_step_time)
self.step_entry = tk.StringVar()
self.step_entry.set("0.025")
step_entry = tk.Entry(timing_control, width=6, textvariable=self.step_entry)
Tooltip.create(step_button, "Click this to increment time by the step value")
Tooltip.create(step_entry, "Time to step (in seconds)")
realtime_mode.set(0)
timing_control.pack(side=tk.TOP, fill=tk.BOTH, expand=1)
# simulation control
sim = tk.LabelFrame(ctrl_frame, text="Robot")
self.state_buttons = []
self.mode = tk.IntVar()
def _set_mode():
self.manager.set_mode(self.mode.get())
button = tk.Radiobutton(
sim, text="Disabled", variable=self.mode, value=self.manager.MODE_DISABLED, command=_set_mode
)
button.pack(fill=tk.X)
self.state_buttons.append(button)
button = tk.Radiobutton(
sim, text="Autonomous", variable=self.mode, value=self.manager.MODE_AUTONOMOUS, command=_set_mode
)
button.pack(fill=tk.X)
self.state_buttons.append(button)
button = tk.Radiobutton(
sim, text="Teleoperated", variable=self.mode, 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)
ctrl_frame.pack(side=tk.LEFT, fill=tk.Y)
开发者ID:Twinters007,项目名称:pyfrc,代码行数:101,代码来源:ui.py
注:本文中的tkinter.ttk.Combobox类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论