本文整理汇总了Python中tkinter.ttk.Combobox.current方法的典型用法代码示例。如果您正苦于以下问题:Python Combobox.current方法的具体用法?Python Combobox.current怎么用?Python Combobox.current使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tkinter.ttk.Combobox
的用法示例。
在下文中一共展示了Combobox.current方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: set_version_combobox
# 需要导入模块: from tkinter.ttk import Combobox [as 别名]
# 或者: from tkinter.ttk.Combobox import current [as 别名]
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
示例2: _makesetting
# 需要导入模块: from tkinter.ttk import Combobox [as 别名]
# 或者: from tkinter.ttk.Combobox import current [as 别名]
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)
示例3: create_widgets
# 需要导入模块: from tkinter.ttk import Combobox [as 别名]
# 或者: from tkinter.ttk.Combobox import current [as 别名]
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)
示例4: adb_Main
# 需要导入模块: from tkinter.ttk import Combobox [as 别名]
# 或者: from tkinter.ttk.Combobox import current [as 别名]
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)
示例5: AppGUI
# 需要导入模块: from tkinter.ttk import Combobox [as 别名]
# 或者: from tkinter.ttk.Combobox import current [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):
#.........这里部分代码省略.........
示例6: SimUI
# 需要导入模块: from tkinter.ttk import Combobox [as 别名]
# 或者: from tkinter.ttk.Combobox import current [as 别名]
#.........这里部分代码省略.........
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)
self.gamedatabox["values"] = messages
self.gamedatabox.current(0)
self.manager.game_specific_message = self.gamedatabox.get()
Tooltip.create(
self.gamedatabox,
"Use this selection box to simulate game specific data",
)
gamedata.pack(side=tk.TOP)
def _reset_robot():
for robot in self.manager.robots:
robot.physics_controller.reset_position()
button = tk.Button(ctrl_frame, text="Reset Robot", command=_reset_robot)
button.pack(side=tk.TOP)
ctrl_frame.pack(side=tk.LEFT, fill=tk.Y)
def _render_pcm(self):
for k, data in sorted(hal_data["pcm"].items()):
if k not in self.pcm:
slot = tk.LabelFrame(self.csfm, text="Solenoid (PCM %s)" % k)
solenoids = []
self.pcm[k] = solenoids
for i in range(len(data)):
label = tk.Label(slot, text=str(i))
c = int(i / 2) * 2
r = i % 2
示例7: CadGui
# 需要导入模块: from tkinter.ttk import Combobox [as 别名]
# 或者: from tkinter.ttk.Combobox import current [as 别名]
class CadGui(object):
def __init__(self,root):
self.root = root
root.title("APOS CAD")
self.xy1 = StringVar()
self.mode = StringVar()
self.IdEntry = StringVar()
self.XEntry = StringVar()
self.XEntry.trace('w',self.numbers_val)
self.YEntry = StringVar()
self.YEntry.trace('w',self.numbers_val)
self.ZEntry = StringVar()
self.ZEntry.trace('w',self.numbers_val)
self.CodeEntry = StringVar()
self.WidthHeight = [800,500]
self.filevar = StringVar() # Filebox
self.openfiles = [data.data[0][1]]
self.colorvar = StringVar() #Colorbox
self.colors = ["Red","Green","Blue","Cyan","Magenta","Yellow","Black","khaki","Orange"]
self.scroll = IntVar() # Scaltefactor
self.scroll.set(1)
self.wheel = IntVar() # Wheel
self.wheel.set(1)
self.savedyx = [0,0] # Last canvas xy for calc
self.modyx = [self.WidthHeight[1],0] # Moved origo
self.modyxset = [0,0] # moved origo hold
self.Map_XY = [0,0] # Crosshairs place on map
self.xy1 = StringVar()
self.mode = StringVar()
self.keyes_w = [0,0]
self.keyes = ["nn"]
self.snapp = ["so"]
self.snapp_xy = [0,0,0]
self.new = [0]
def passit():
pass
self.menubar = Menu(root)
self.filemenu = Menu(self.menubar, tearoff=0)
self.filemenu.add_command(label="New", command= self.newfile)
self.filemenu.add_command(label="Open", command= self.openfile)
self.filemenu.add_command(label="Save", command= self.save)
self.filemenu.add_command(label="Save as...", command= self.saveas)
self.filemenu.add_command(label="Close", command= self.close)
self.filemenu.add_separator()
self.filemenu.add_command(label="Exit", command=self.root.quit)
self.menubar.add_cascade(label="File", menu=self.filemenu)
self.editmenu = Menu(self.menubar, tearoff=0)
self.editmenu.add_command(label="Undo", command=passit())
self.editmenu.add_separator()
self.editmenu.add_command(label="Cut", command=passit())
self.editmenu.add_command(label="Copy", command=passit())
self.editmenu.add_command(label="Paste", command=passit())
self.editmenu.add_command(label="Delete", command=passit())
self.editmenu.add_command(label="Select All", command=passit())
self.menubar.add_cascade(label="Edit", menu=self.editmenu)
self.drawmenu = Menu(self.menubar, tearoff=0)
self.drawmenu.add_command(label="Point D>P", command=functools.partial(self.keypressed,event='<tkinter.Event object>', char1=['d','p']))
self.drawmenu.add_command(label="Line D>L", command=functools.partial(self.keypressed,event='<tkinter.Event object>', char1=['d','l']))
self.drawmenu.add_separator()
self.drawmenu.add_command(label="ARC_3p A>3", command=functools.partial(self.keypressed,event='<tkinter.Event object>', char1=['a','3']))
self.menubar.add_cascade(label="Draw", menu=self.drawmenu)
self.snappmenu = Menu(self.menubar, tearoff=0)
self.snappmenu.add_command(label="Point S>P", command=functools.partial(self.keypressed,event='<tkinter.Event object>', char1=['s','p']))
self.snappmenu.add_command(label="NoSnapp S>O", command=functools.partial(self.keypressed,event='<tkinter.Event object>', char1=['s','o']))
self.menubar.add_cascade(label="Snapp", menu=self.snappmenu)
self.helpmenu = Menu(self.menubar, tearoff=0)
self.helpmenu.add_command(label="Help", command=passit())
self.helpmenu.add_command(label="About...", command=passit())
self.menubar.add_cascade(label="Help", menu=self.helpmenu)
self.root.config(menu=self.menubar)
self.filebox = Combobox(root, textvariable=self.filevar, values=self.openfiles, state='readonly')
self.filebox.current(0)
self.colorbox = Combobox(root, textvariable=self.colorvar, values=self.colors, state='readonly')
self.colorbox.current(data.data[0][0])
self.draw = Canvas(root, cursor="none", width=self.WidthHeight[0], height=self.WidthHeight[1])
self.label1 = Label(root, textvariable = self.mode, bg="white", fg="black")
self.label2 = Label(root, textvariable = self.xy1, bg="white", fg="black")
self.label3 = Label(root, textvariable = self.scroll, bg="white", fg="black")
self.label4 = Label(root, text = "Tools", bg="white", fg="black")
self.xyzgroup = LabelFrame(root, text="Insert", padx=5, pady=5,width=100,height=self.WidthHeight[1])
self.ID = Label(self.xyzgroup,text="Id:")
self.IdE = Entry(self.xyzgroup, textvariable = self.IdEntry)
#.........这里部分代码省略.........
示例8: LevelWindow
# 需要导入模块: from tkinter.ttk import Combobox [as 别名]
# 或者: from tkinter.ttk.Combobox import current [as 别名]
class LevelWindow(object):
"""Fenêtre de configuration du niveau de l'algorithme"""
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)
def on_cb_change(self, event=None) :
"""Quand on change le niveau"""
self.cb_lv.selection_clear()
niveau = self.cb_lv.current()+1
self.lv_param['niveau'] = niveau
self.lb_info['text'] = self.infos_niveaux[self.cb_lv.current()]
# Pour les niveaux 4 et 6, paramètres supplémentaires
if niveau == 4 :
self.lb_param['text'] = "Échantillons : "
self.txt_param.delete('1.0', END)
self.txt_param.insert(END, "100")
self.lb_param.pack(side=LEFT, padx=10)
self.txt_param.pack(side=LEFT)
elif niveau == 6 :
self.lb_param['text'] = "Seuil : "
self.txt_param.delete('1.0', END)
self.txt_param.insert(END, "60")
self.lb_param.pack(side=LEFT, padx=10)
self.txt_param.pack(side=LEFT)
else :
self.lb_param.pack_forget()
self.txt_param.pack_forget()
def valide(self, event=None):
"""Validation des paramètres"""
self.lv_param['seuil'] = int(self.txt_param.get('1.0', END)[:-1])
self.lv_param['échantillons'] = int(self.txt_param.get('1.0', END)[:-1])
self.window.destroy()
示例9: __init__
# 需要导入模块: from tkinter.ttk import Combobox [as 别名]
# 或者: from tkinter.ttk.Combobox import current [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
示例10: __init__
# 需要导入模块: from tkinter.ttk import Combobox [as 别名]
# 或者: from tkinter.ttk.Combobox import current [as 别名]
class mainGUI:
def __init__(self):
root = Tk()
root.wm_title("ThreadCam")
self.threadingVelocityVar = StringVar()
self.groovingVelocityVar = StringVar()
self.pitchToggle = StringVar()
self.threadingToolEntry = {}
self.groovingToolEntry = {}
self.threadDataEntry = {}
self.miscDataEntry = {}
#Menubar
menuBar = Menu(root)
fileMenu = Menu(menuBar, tearoff=0)
fileMenu.add_command(label="Open", command=self.openCommand)
fileMenu.add_command(label="Save", command=self.saveCommand)
fileMenu.add_separator()
fileMenu.add_command(label="Exit", command=root.quit)
menuBar.add_cascade(label="File", menu=fileMenu)
programMenu = Menu(menuBar, tearoff=0)
programMenu.add_command(label="Generate", command=self.generateMenuCommand)
programMenu.add_command(label="Report...", command=self.reportCommand)
menuBar.add_cascade(label="Program", menu=programMenu)
root.config(menu=menuBar)
#End Menubar
#Tool Data Frame
toolDataFrame = Frame()
toolDataFrame.grid(padx=5, row=0, column=0, sticky=EW)
toolDataFrame.columnconfigure(2, weight=1)
label = Label(toolDataFrame, text="Tool Data", font=("Lucida Console bold", 18))
label.grid(row=0, column=0, sticky=W)
self.unitsVar = StringVar()
self.unitsVar.trace('w', self.unitsChange)
self.unitsBox = Combobox(toolDataFrame, state='readonly', width=10, textvar=self.unitsVar)
self.unitsBox['values'] = ('Imperial', 'Metric')
self.unitsBox.current(0)
self.unitsBox.grid(row=0, column=2, sticky=E, padx=5)
separator = Frame(toolDataFrame, height=2, bd=1, relief=SUNKEN)
separator.grid(pady=5, row=1, columnspan=7, sticky=EW)
#Threading Tool Data Frame
threadingToolFrame = Frame(toolDataFrame)
threadingToolFrame.grid(row=2, column=0, sticky=EW)
label = Label(threadingToolFrame, text="Threading Tool", font=("Lucida Console", 14))
label.grid(row=0, column=0, sticky=W)
Label(threadingToolFrame, text="Tool Number") .grid(row=1, column=0, sticky=W)
Label(threadingToolFrame,
textvar=self.threadingVelocityVar) .grid(row=2, column=0, sticky=W)
Label(threadingToolFrame, text="PDX") .grid(row=3, column=0, sticky=W)
Label(threadingToolFrame, text="NAP") .grid(row=4, column=0, sticky=W)
self.threadingToolEntry["toolNumber"] = Entry(threadingToolFrame, width=10)
self.threadingToolEntry["velocity"] = Entry(threadingToolFrame, width=10)
self.threadingToolEntry["PDX"] = Entry(threadingToolFrame, width=10)
self.threadingToolEntry["NAP"] = Entry(threadingToolFrame, width=10)
self.threadingToolEntry["toolNumber"] .grid(row=1, column=1, sticky=W)
self.threadingToolEntry["velocity"] .grid(row=2, column=1, sticky=W)
self.threadingToolEntry["PDX"] .grid(row=3, column=1, sticky=W)
self.threadingToolEntry["NAP"] .grid(row=4, column=1, sticky=W)
separator = Frame(threadingToolFrame, height=0, bd=0, relief=SUNKEN)
separator.grid(padx=5, pady=5, row=5, columnspan=7)
Label(threadingToolFrame, text="Insert ID") .grid(row=6, column=0, sticky=W)
Label(threadingToolFrame, text="Cutting Unit ID") .grid(row=8, column=0, sticky=W)
Label(threadingToolFrame, text="Clamping Unit ID") .grid(row=10, column=0, sticky=W)
self.threadingToolEntry["insertID"] = Entry(threadingToolFrame, width=30)
self.threadingToolEntry["unitID"] = Entry(threadingToolFrame, width=30)
self.threadingToolEntry["clampingID"] = Entry(threadingToolFrame, width=30)
self.threadingToolEntry["insertID"] .grid(row=7, column=0, columnspan=2, sticky=W)
self.threadingToolEntry["unitID"] .grid(row=9, column=0, columnspan=2, sticky=W)
self.threadingToolEntry["clampingID"] .grid(row=11, column=0, columnspan=2, sticky=W)
#End Threading Tool Data Frame
separator = Frame(toolDataFrame, height=2, bd=1, relief=SUNKEN)
separator.grid(padx=10, row=3, column=1)
#Grooving Tool Data Frame
groovingToolFrame = Frame(toolDataFrame)
groovingToolFrame.grid(row=2, column=2, sticky=EW)
label = Label(groovingToolFrame, text="Grooving Tool", font=("Lucida Console", 14))
label.grid(row=0, column=0, sticky=W)
Label(groovingToolFrame, text="Tool Number") .grid(row=1, column=0, sticky=W)
#.........这里部分代码省略.........
示例11: Menu
# 需要导入模块: from tkinter.ttk import Combobox [as 别名]
# 或者: from tkinter.ttk.Combobox import current [as 别名]
editmenu.add_command(label="Cut", command=donothing)
editmenu.add_command(label="Copy", command=donothing)
editmenu.add_command(label="Paste", command=donothing)
editmenu.add_command(label="Delete", command=clearit)
editmenu.add_command(label="Select All", command=donothing)
menubar.add_cascade(label="Edit", menu=editmenu)
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)
示例12: Application
# 需要导入模块: from tkinter.ttk import Combobox [as 别名]
# 或者: from tkinter.ttk.Combobox import current [as 别名]
class Application(Frame):
def __init__(self, master=None):
Frame.__init__(self, master)
root.title("NHL Stats to CSV")
self.pack()
self.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)
def quit(self):
root.destroy()
def start(self):
self.progress.config(text="Working...")
season_fn = self.season.get()
season = season_fn.replace("-", "")
gameType = self.gameType.get()
if gameType == "Regular Season":
gameType = "2"
else:
gameType = "3"
grouping = self.grouping.get()
position = self.position.get()
if position == "All Skaters":
position = "S"
position = position[0]
# For csv filename
gameTypes = {"2": "regularseason", "3": "playoffs"}
positions = {"S": "skater", "G": "goalie", "F": "forward", "D": "defenseman",
"C": "center", "L": "leftwing", "R": "rightwing"}
gameType_fn = gameTypes[gameType]
position_fn = positions[position]
grouping_fn = ""
if grouping == "By League":
grouping_fn = "byleague"
else:
grouping_fn = "byteam"
self.filename = "nhl_" + season_fn + "_" + gameType_fn + "_" + position_fn + "stats" + "_" + grouping_fn + ".csv"
# Stat column headings
#.........这里部分代码省略.........
示例13: Tk
# 需要导入模块: from tkinter.ttk import Combobox [as 别名]
# 或者: from tkinter.ttk.Combobox import current [as 别名]
win = Tk()
win.title("Window Title")
def clicked():
L.configure(text= txt.get()+"_Button was clicked !!")
L = Label(win, text="Label")
L.grid(column=0, row=0)
#lbl1 = Label(tab1, text= 'label1', padx=5, pady=5)
txt = Entry(win,width=10, text="Def")
txt.grid(column=0, row=1)
combo = Combobox(win)
combo['values']= (1, 2, 3, 4, 5, "Text")
combo.current(3) #set the selected item
combo.grid(column=0, row=2)
chk = Checkbutton(win, text='Choose')
chk.grid(column=0, row=3)
#chk_state.set(1)
btn = Button(win, text="Click Me", command=clicked)
btn.grid(column=0, row=4)
quitButton = Button(win, text="Quit",
command=win.quit)
quitButton.grid(column=1, row=4)
txt.focus()
示例14: Label
# 需要导入模块: from tkinter.ttk import Combobox [as 别名]
# 或者: from tkinter.ttk.Combobox import current [as 别名]
Label(printerFrame, text="Monitor").pack(anchor=W)
monitorSelect = Combobox(printerFrame, values = monitorList, state="readonly", textvariable=vMonitor)
monitorSelect.pack()
confMonitor = Button(printerFrame, text="Configure Monitor", state="disabled", command = openMonitorConfig)
confMonitor.pack(pady=5, anchor=W, fill=X)
Label(printerFrame, text="COM Port").pack(anchor=W)
comSelect = Combobox(printerFrame, values = comPortNames, state="readonly", textvariable=vComPort)
comSelect.pack()
if selectedMonIndex != -1:
monitorSelect.current(int(selectedMonIndex))
confMonitor.configure(state="normal")
if selectedComPortIndex != -1:
print(selectedComPortIndex)
vComPort.set(comPortNames[int(selectedComPortIndex)])
vBaudRate.set(config.get('baudRate'))
vMonitor.trace('w', monitorChanged)
vComPort.trace('w', comPortChanged)
vBaudRate.trace('w', comPortChanged)
Label(printerFrame, text="Baud Rate").pack(anchor=W)
baudSelect = Combobox(printerFrame, values = [300, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400, 250000, 2500000], textvariable=vBaudRate)
baudSelect.pack()