本文整理汇总了Python中ttk.Combobox.place方法的典型用法代码示例。如果您正苦于以下问题:Python Combobox.place方法的具体用法?Python Combobox.place怎么用?Python Combobox.place使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ttk.Combobox
的用法示例。
在下文中一共展示了Combobox.place方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: editor
# 需要导入模块: from ttk import Combobox [as 别名]
# 或者: from ttk.Combobox import place [as 别名]
def editor():
"""Run editor"""
global zone_dessin
global grid
global entry_retour
global combobox_difficulty
global lvlList
grid = Grid()
# Windows
fenetre = Tk()
fenetre.geometry("500x525")
fenetre.title("Editeur Hanjie")
fenetre.resizable(width=False, height=False)
# Canvas
zone_dessin = Canvas(fenetre,width=500,height=500, bg="white")
zone_dessin.place(x=0,y=0)
Initialisation()
zone_dessin.bind("<Button-1>", Swap)
# Entry
default_text = StringVar()
entry_retour = Entry(fenetre,width=20,textvariable=default_text)
default_text.set("Level name...")
entry_retour.place(x=2,y=503)
# Save Button
button_save = Button(fenetre,text="Save", width=8,height=1, command = But_Save)
button_save.place(x=130,y=500)
# Load Button
button_load = Button(fenetre,text="Load", width=8,height=1, command = But_Load)
button_load.place(x=200,y=500)
# Reset Button
button_load = Button(fenetre,text="Reset", width=8,height=1, command = But_Reset)
button_load.place(x=270,y=500)
# Difficulty Combobox
lvlSelect = StringVar()
lvlList = ('LVL 1', 'LVL 2', 'LVL 3', 'LVL 4', 'LVL 5')
combobox_difficulty = Combobox(fenetre, values = lvlList, state = 'readonly')
combobox_difficulty.set(lvlList[0])
combobox_difficulty.place(x=340,y=502)
fenetre.mainloop()
示例2: __init__
# 需要导入模块: from ttk import Combobox [as 别名]
# 或者: from ttk.Combobox import place [as 别名]
class main:
def __init__(self, master):
#-----------------------Interface gráfica----------------------------------------------------
self.frame1 = Frame(master, bg = COR_FUNDO)
self.frame1.place(relheight = 1.0, relwidth = 1.0)
self.botao_refresh = Button(self.frame1, text = 'Atualizar dispositivos', font = ('Courier','10'),
fg = 'black', bg = COR_BOTAO_2, borderwidth = 3,
command = self.devices)
self.botao_refresh.place(relx = 0.202, rely = 0.02, relwidth = 0.54)
Label(self.frame1, text = 'Escolha o dispositivo(CUIDADO)',
font=('Courier','14'), fg = 'red', bg = COR_FUNDO).place(relx = 0.02, rely = 0.12)
self.device = Combobox(self.frame1, font = ('Ariel','15'))
self.device.place(relx = 0.04, rely = 0.20, relwidth = 0.90)
Label(self.frame1, text='Escolha o Sistema de arquivos',
font=('Courier','14'), fg = 'white', bg = COR_FUNDO).place(relx = 0.02, rely = 0.32)
self.sis = Combobox(self.frame1, font = ('Ariel','15'))
self.sis.place(relx = 0.04, rely = 0.40, relwidth = 0.90)
self.botao_formatar = Button(self.frame1, text = 'Formatar', font = ('Courier','25'),
fg = 'black', bg = COR_BOTAO_1, borderwidth = 3,
command = self.formatar)
self.botao_formatar.bind("<Button-1>", self.mudabotao)
self.botao_formatar.place(relx = 0.21, rely = 0.82, relwidth = 0.54)
self.devices()
self.sis_file()
#----------------------Funções---------------------------------------------------------------
def devices(self):
#devices = subprocess.check_output(['cat','/proc/partitions']).split('\n')
self.device['values'] = USBdrv().mounted_drvs
def sis_file(self):
sis_file = ['ext2','vfat','ntfs','reiserfs']
self.sis['values'] = sis_file
def mudabotao(self,event):
self.botao_formatar['text'] = 'Espere'
def formatar(self):
dv = self.device.get()
st = self.sis.get()
try:
subprocess.call(['umount','%s'%dv])
if st == 'vfat':
subprocess.call(['mkfs.vfat', '%s' %dv])
elif st == 'ntfs':
subprocess.call(['mkfs.ntfs', '%s' %dv])
elif st == 'reiserfs':
subprocess.call(['mkfs.reiserfs', '%s' %dv])
else:
subprocess.call(['mkfs.ext2', '%s' %dv])
tkMessageBox.showinfo('Aviso!',u'Device formatado com sucesso')
except:
tkMessageBox.showinfo('Erro!',u'Device ocupado, ou inválido, ou você não é root')
self.devices()
self.botao_formatar['text'] = 'Formatar'