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()
def initUI(self): self.title('Preferences') self.rowconfigure(0, pad=6) self.rowconfigure(1, pad=1) self.rowconfigure(2, pad=6) self.columnconfigure(0, pad=1) self.columnconfigure(1, pad=1) self.columnconfigure(2, pad=1) label1 = Label(self, text='Graph Font') self.combobox_fonts = Combobox(self, values=self.font_names, width=16) self.combobox_fonts.current( self.font_names.index(self.parent.font_name)) label1.grid(row=0, column=0, sticky=W) self.combobox_fonts.grid(row=0, column=1, columnspan=2, sticky=W) label2 = Label(self, text='Line Color') self.combobox_color = Combobox(self, values=self.parent.line_colors, width=8) self.combobox_color.current( self.parent.line_colors.index(self.parent.line_color)) label2.grid(row=1, column=0, sticky=W) self.combobox_color.grid(row=1, column=1, columnspan=2, sticky=W) buttonOK = Button(self, text='OK', command=self.on_OK, width=16) buttonApply = Button(self, text='Apply', command=self.on_Apply, width=16) buttonQuit = Button(self, text='Quit', command=self.on_Quit, width=16) buttonOK.grid(row=2, column=0, sticky=W + E + S) buttonApply.grid(row=2, column=1, sticky=W + E + S) buttonQuit.grid(row=2, column=2, sticky=W + E + S)
def init_ui(self): self.parent.title("Activity Logger") self.parent.focusmodel("active") self.style = Style() self.style.theme_use("aqua") self.combo_text = StringVar() cb = self.register(self.combo_complete) self.combo = Combobox(self, textvariable=self.combo_text, validate="all", validatecommand=(cb, '%P')) self.combo['values'] = ["Food", "Email", "Web"] self.combo.pack(side=TOP, padx=5, pady=5, fill=X, expand=0) #self.entry = Text(self, bg="white", height="5") #self.entry.pack(side=TOP, padx=5, pady=5, fill=BOTH, expand=1) self.pack(fill=BOTH, expand=1) self.centre() self.ok = Button(self, text="Ok", command=self.do_ok) self.ok.pack(side=RIGHT, padx=5, pady=5) self.journal = Button(self, text="Journal", command=self.do_journal) self.journal.pack(side=RIGHT, padx=5, pady=5) self.exit = Button(self, text="Exit", command=self.do_exit) self.exit.pack(side=RIGHT, padx=5, pady=5)
def add_attr(self): """添加一行数据""" for i, property_name in enumerate(self.properties.keys()): configs = self.properties.get(property_name) getattr(self, 'attr_%ss' % property_name).append(StringVar()) if 'type' not in configs: getattr(self, 'entry_%ss' % property_name).append( Entry(self.group, width=configs.get('width'), textvariable=getattr( self, 'attr_%ss' % property_name)[self.attr_count])) else: getattr(self, 'entry_%ss' % property_name).append( Combobox(self.group, width=configs.get('width'), textvariable=getattr( self, 'attr_%ss' % property_name)[self.attr_count], values=configs.get('type'))) getattr(self, 'entry_%ss' % property_name)[self.attr_count].current(0) if self.__is_column_show(i): getattr(self, 'entry_%ss' % property_name)[self.attr_count].grid( row=self.attr_count + 1, column=i) getattr(self, 'entry_types')[self.attr_count].bind('<<ComboboxSelected>>', self.on_select) getattr(self, 'entry_inner_types')[self.attr_count].bind( '<<ComboboxSelected>>', self.on_select_inner) getattr(self, 'entry_inner_types')[self.attr_count]['state'] = DISABLED self.attr_count += 1
def createWidgets(self): self.mainFrame = Frame(self.parent) Label(self.mainFrame, text='2048 Game', font=(",30"), fg="#2980b9").pack(padx=20, pady=20) f1 = Frame(self.mainFrame) Label(f1, text='Grid').pack(side=LEFT, padx=5) Combobox(f1, textvariable=self.grid).pack(side=LEFT, padx=50) Button(f1, text='Play', command=self.play).pack(side=LEFT, padx=5) f1.pack(pady=10) self.winFrame = Frame(self.parent) Label(self.winFrame, text=' you win!', font=('', 30), fg='#e74c3c').pack(padx=20, pady=10) Label(self.winFrame, textvariable=self.moves, font=('', 30), fg='#e74c3c').pack() f2 = Frame(self.winFrame) Button(f2, text='play again', command=self.play).pack(side=LEFT, padx=5) Button(f2, text='Cancel', command=self.showMainFrame).pack(side=LEFT, padx=5) f2.pack(pady=10) self.gameOverFrame = Frame(self.parent) Label(self.gameOverFrame, text='Gameover!', font=('', 30), fg='#e74c3c').pack(padx=20, pady=10) f2 = Frame(self.gameOverFrame) Button(f2, text='play again', command=self.play).pack(side=LEFT, padx=5) Button(f2, text='Cancel', command=self.showMainFrame).pack(side=LEFT, padx=5) f2.pack(pady=10)
def gui(self): self.root = Tk() self.root.title('video converter') self.entry_link = Entry(self.root, width=self.ENTRY_WITDH, state='disabled') self.entry_link.grid(row=0, column=0, columnspan=2) self.link_contend = StringVar() self.entry_link.config(textvariable=self.link_contend) self.link_contend.set('plz choose:') self.choose_button = Button(self.root, text='choose', width=self.button_width, command=self.chooseFile) self.choose_button.grid(row=1, column=0, columnspan=1) self.clear_button = Button(self.root, text='empty', width=self.button_width, command=self.emptyIt) self.clear_button.grid(row=1, column=1, columnspan=1) self.outType = StringVar() self.typeChosen = Combobox(self.root, width=self.ENTRY_WITDH, textvariable=self.outType) self.typeChosen['values'] = ('wav', 'mp4', 'flv', 'mp3', 'gif') self.typeChosen.current(3) self.typeChosen.grid(row=2, column=0, columnspan=2) self.startButton = Button(self.root, text='Start Convert', width=self.button_width * 2, command=self.startFFmpeg) self.startButton.grid(row=3, column=0, columnspan=2) self.result_link = Entry(self.root, width=self.ENTRY_WITDH, state='disabled') self.result_link.grid(row=4, column=0, columnspan=2) self.result_link_contend = StringVar() self.result_link.config(textvariable=self.result_link_contend) self.result_link_contend.set('plz hold on:') mainloop()
def initUI(self): self.lbox = Listbox(self, height = 10, width = 55) sbar = Scrollbar(self, command=self.lbox.yview) sbar.place(x=360, y=240) self.lbox.config(yscrollcommand=sbar.set) self.lbox.place(x=10, y=240) self.lbox.insert('end', "Interface Básica de Controle dos Motores - v1.0") self.lbox.insert('end', "S.O. (%s)" % (sys.platform)) self.parent.title("Interface básica para controle dos motores - v1.0") self.pack(fill=BOTH, expand=1) self.opts = "" self.cbox = Combobox(self, textvariable=self.opts, state='readonly') for n,s in scan(): self.opts += "%s " % (s) self.cbox['values'] = self.opts if(self.opts != ""): self.cbox.current(0) self.cbox.place(x=10, y=10) "self.cbox.bind('<<ComboboxSelected>>', self.conectar)" btConectar = Button(self, text="Conectar", width=10) btConectar.bind("<Button-1>", self.conectar) btConectar.place(x=200, y=10) btFrente = Button(self, text="/\\", width=5) btFrente.bind("<Button-1>", self.comandoF) btFrente.place(x=160, y=100) btTraz = Button(self, text="\/", width=5) btTraz.bind("<Button-1>", self.comandoT) btTraz.place(x=160, y=130) btEsqFrente = Button(self, text="/\\", width=5) btEsqFrente.place(x=50, y=70) btEsqFrente.bind("<Button-1>", self.comandoEF) btEsqTraz = Button(self, text="\/", width=5) btEsqTraz.place(x=50, y=150) btEsqTraz.bind("<Button-1>", self.comandoET) btDirFrente = Button(self, text="/\\", width=5) btDirFrente.place(x=260, y=70) btDirFrente.bind("<Button-1>", self.comandoDF) btDirTraz = Button(self, text="\/", width=5) btDirTraz.place(x=260, y=150) btDirTraz.bind("<Button-1>", self.comandoDT) btGiraEsq = Button(self, text=">>", width=5) btGiraEsq.place(x=90, y=200) btGiraEsq.bind("<Button-1>", self.comandoGE) btParar = Button(self, text="-x-", width=5) btParar.place(x=160, y=200) btParar.bind("<Button-1>", self.comandoP) btGiraDir = Button(self, text="<<", width=5) btGiraDir.place(x=230, y=200) btGiraDir.bind("<Button-1>", self.comandoGD)
def _add_choice(self, frame, index, name, choices, default, option): self.function[-1] = lambda v: [option, v] label = Label(frame, text=name) label.grid(row=index, column=0, sticky="W", padx=10) field = Combobox(frame, values=choices, state="readonly") field.set(default) field.grid(row=index, column=1, sticky="WE") self.variables[-1] = field
def get_map_list(self): self.available_maps = sorted( m for m in get_available_maps(config=self.config)) self.map_list = Combobox(self.button_frame, height=24, width=24, values=self.available_maps) if len(self.available_maps): self.map_list.set(self.available_maps[0])
def initgui(self): self.root.title("Tick tack toe") self.root.resizable(False, False) self.frame_board = Frame(self.root, bg="black") self.canvas = Canvas(self.frame_board, width=600, height=600, bg="beige") self.frame_options = Frame(self.root) self.button_setup = Button(self.frame_options, text="Setup", width=10) self.button_start = Button(self.frame_options, text="Start", width=10) self.button_reset = Button(self.frame_options, text="Reset", width=10) self.button_reload = Button(self.frame_options, text="Load Bots", width=10) self.button_test = Button(self.frame_options, text="Test", width=10) self.entry_test = Entry(self.frame_options, width=10) self.label1 = Label(self.frame_options, text="Player 1") self.label2 = Label(self.frame_options, text="Player 2") self.combo1 = Combobox(self.frame_options, state="readonly") self.combo2 = Combobox(self.frame_options, state="readonly") self.entry_shape1 = Entry(self.frame_options, width=5) self.entry_shape2 = Entry(self.frame_options, width=5) self.label_size = Label(self.frame_options, text="Board Size") self.entry_size = Entry(self.frame_options, width=10) self.label_movements = Label(self.frame_options, text="Steps") self.movements = Listbox(self.frame_options, width=25, height=15) self.chainVar = 0 self.button_chain = Button(self.frame_options, text="Show Chains", width=10) self.button_help = Button(self.frame_options, text="?", width=3) self.label_version = Label(self.frame_options, text="Version v" + self.version)
def cluster_dis(self): # canvas and listbox self.canvas1 = Canvas(self.frame3, bg='#FFFFFF', width=1100, height=300) self.canvas1.grid(row=0, column=0) self.scollbary = Scrollbar(self.frame3, orient="vertical", command=self.canvas1.yview) self.scollbary.grid(row=0, column=0, sticky='nsew') self.scollbarx = Scrollbar(self.frame3, orient="horizontal", command=self.canvas1.xview) self.scollbarx.grid(row=0, column=0, sticky='nsew') Label(self.frame4, text="Districts :").grid(row=0, column=0) self.districts_listbox = Listbox(self.frame4, selectmode="multiple", height=13, width=20) self.districts_listbox.grid(row=0, column=1) # adding districts to listbox for i in self.results.keys(): self.districts_listbox.insert(END, i) self.scollbary_listbox = Scrollbar( self.frame4, orient="vertical", command=self.districts_listbox.yview) self.scollbary_listbox.grid(row=0, column=1, sticky='nsew') Label(self.frame4, text="Threshold :").grid(row=0, column=2) self.combobox = Combobox( self.frame4, state="readonly", values=["%0", "%1", "%10", "%20", "%30", "%40", "%50"]) self.combobox.grid(row=0, column=3) self.refine_button = Button(self.frame4, text="Refine Analysis", width=45, height=2, command=self.cluster_dis) self.refine_button.grid(row=0, column=4)
def addActionFrame(self): frame = Frame(self, relief=tk.RAISED, borderwidth=1) frame.pack(fill=tk.X,side=tk.TOP,\ expand=0,padx=8,pady=5) #label=tk.Label(frame,text='Actions:',bg='#bbb') #label.grid(row=0,column=0,sticky=tk.W,padx=8) #---------------Action checkbuttons--------------- frame.columnconfigure(0, weight=1) #---------------------2nd row--------------------- subframe = Frame(frame) subframe.grid(row=1,column=0,columnspan=6,sticky=tk.W+tk.E,\ pady=5) #-------------------Album options------------------- albumlabel=tk.Label(subframe,text=dgbk('专辑:'),\ bg='#bbb') albumlabel.pack(side=tk.LEFT, padx=8) self.album = tk.StringVar() self.albumnames = [ 'All', ] self.albummenu=Combobox(subframe,textvariable=\ self.album,values=self.albumnames,state='readonly') self.albummenu.current(0) self.albummenu.bind('<<ComboboxSelected>>', self.setAlbum) self.albummenu.pack(side=tk.LEFT, padx=8) #-------------------Quit button------------------- quit_button=tk.Button(subframe,text=dgbk('退出'),\ command=self.quit) quit_button.pack(side=tk.RIGHT, padx=8) #-------------------Stop button------------------- ''' self.stop_button=tk.Button(subframe,text='Stop',\ command=self.stop) self.stop_button.pack(side=tk.RIGHT,padx=8) ''' #-------------------Start button------------------- self.start_button=tk.Button(subframe,text=dgbk('开始'),\ command=self.start,state=tk.DISABLED) self.start_button.pack(side=tk.RIGHT, pady=8) #-------------------Help button------------------- self.help_button=tk.Button(subframe,text=dgbk('帮助'),\ command=self.showHelp) self.help_button.pack(side=tk.RIGHT, padx=8)
def body(self, master): self._npFrame = LabelFrame(master, text='Annotation window text') self._npFrame.pack(fill=X) self._fontFrame = Frame(self._npFrame, borderwidth=0) self._fontLabel = Label(self._fontFrame, text='Font:', width=5) self._fontLabel.pack(side=LEFT, padx=3) self._fontCombo = Combobox(self._fontFrame, values=sorted(families()), state='readonly') self._fontCombo.pack(side=RIGHT, fill=X) self._sizeFrame = Frame(self._npFrame, borderwidth=0) self._sizeLabel = Label(self._sizeFrame, text='Size:', width=5) self._sizeLabel.pack(side=LEFT, padx=3) self._sizeCombo = Combobox(self._sizeFrame, values=range(8, 15), state='readonly') self._sizeCombo.pack(side=RIGHT, fill=X) self._fontFrame.pack() self._sizeFrame.pack() self._npFrame.pack(fill=X) self._fontCombo.set(self.font) self._sizeCombo.set(self.size)
def add_param_fields(self, frame, rownum, object_map): #create the fields key_option_val = StringVar(frame) key_option_val.set(self.keywords[0]) key_option_menu = Combobox(frame, textvariable=key_option_val, state='readonly') key_option_menu['values'] = self.keywords key_option_menu.grid(row=0, column=0, sticky=W, pady=10, padx=10) val_text = StringVar(frame) val_entry = Entry(frame, textvariable=val_text) val_entry.grid(row=0, column=1, pady=10, padx=10, sticky=W) object_map.append((key_option_val, val_text))
def __init__(self, root, *args, **kwargs): label_kwargs = dict(text=kwargs.pop('label', '')) combobox_kwargs = dict() combobox_kwargs['state'] = kwargs.pop('state', 'normal') combobox_kwargs['textvariable'] = kwargs.pop('textvariable', None) Frame.__init__(self, root, *args, **kwargs) self.label = Label(self, **label_kwargs) self.combobox = Combobox(self, **combobox_kwargs) self.values = list() self.label.pack(side=LEFT) self.combobox.pack(side=RIGHT)
def __init__(self, parent, question, i, defaultanswer, *options): LabelFrame.__init__(self, parent, text=question, padx=5, pady=5) self.var = StringVar(parent) try: if defaultanswer in options: options = tuple(x for x in options if x != defaultanswer) options = (defaultanswer,) + options self.var.set(options[0]) except IndexError: self.var.set("") self.om = Combobox(self, textvariable=self.var) self.om['values'] = options self.om.pack(padx=5,pady=5, side="left") self.grid(row=i,column=0,columnspan=3, sticky=W, pady=10)
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()
def initUI(self): self.parent.title("Combobox") self.pack(fill=BOTH, expand=True) frame = Frame(self) frame.pack(fill=X) field = Label(frame, text="Typing Speed:", width=15) field.pack(side=LEFT, padx=5, pady=5) self.box_value = StringVar() self.box = Combobox(frame, textvariable=self.box_value, width=5) self.box['values'] = ('1x', '2x', '5x', '10x') self.box.current(0) self.box.pack(fill=X, padx=5, expand=True) self.box.bind("<<ComboboxSelected>>", self.value)
def __init__(self, master=None, main=None): Frame.__init__(self, master) self.parent = master self.main = main self.parent.geometry("280x174") self.parent.title(os.getenv("NAME") + " - Advance Board Config") self.master.configure(padx=10, pady=10) self.HEAPSIZE = {"512 byte": 512, "1024 byte": 1024,} self.OPTIMIZATION = "-O2 -O3 -Os".split() self.mips16_var = IntVar() self.checkBox_mips16 = Checkbutton(self.parent, text="Mips16", anchor="w", variable=self.mips16_var) self.checkBox_mips16.pack(expand=True, fill=BOTH, side=TOP) frame_heap = Frame(self.parent) Label(frame_heap, text="Heap size:", anchor="w", width=12).pack(side=LEFT, fill=X, expand=True) self.comboBox_heapsize = Combobox(frame_heap, values=self.HEAPSIZE.keys()) self.comboBox_heapsize.pack(fill=X, expand=True, side=RIGHT) frame_heap.pack(fill=X, expand=True, side=TOP) frame_opt = Frame(self.parent) Label(frame_opt, text="Optimization:", anchor="w", width=12).pack(side=LEFT, fill=X, expand=True) self.comboBox_optimization = Combobox(frame_opt, values=self.OPTIMIZATION) self.comboBox_optimization.pack(fill=X, expand=True, side=RIGHT) frame_opt.pack(fill=X, expand=True, side=TOP) frame_buttons = Frame(self.parent) Button(frame_buttons, text="Accept", command=self.accept_config).pack(fill=X, expand=True, side=LEFT) Button(frame_buttons, text="Restore Default", command=self.restore_default).pack(fill=X, expand=True, side=RIGHT) frame_buttons.pack(fill=X, expand=True, side=BOTTOM) self.load_config()
def dynamic(self): self.canvasframe = Frame(self) # to keep canvas self.canvasframe.pack(fill=X) self.canvas = Canvas(self.canvasframe, bg='grey') self.vbar = Scrollbar(self.canvasframe, orient=VERTICAL) # vertical scrollbar self.vbar.pack(side=RIGHT, fill=Y) self.vbar.config( command=self.canvas.yview) # to adapt vertical scrollbar to canvas self.hbar = Scrollbar(self.canvasframe, orient=HORIZONTAL) # horizontal scrollbar self.hbar.pack(side=BOTTOM, fill=X) self.hbar.config(command=self.canvas.xview ) # to adapt horizontal scrollbar to canvas self.canvas.pack(fill=X) self.canvas.config( xscrollcommand=self.hbar.set, yscrollcommand=self.vbar.set) # to set scrollbars in canvas self.bottomframe = Frame(self) # Frame to keep listbox and so on self.bottomframe.pack(fill=X) Label(self.bottomframe, text='Districts:').pack(side=LEFT, padx=(150, 0)) # districts label self.scroll = Scrollbar(self.bottomframe, orient="vertical") # Scrollbar to listbox self.listbox = Listbox(self.bottomframe, selectmode='multiple', yscrollcommand=self.scroll.set) self.listbox.pack(side=LEFT) self.scroll.config(command=self.listbox.yview ) # to adapt vertical scrollbar to canvas self.scroll.pack(side=LEFT, fill="y") Label(self.bottomframe, text='Treshould:').pack(side=LEFT) self.combo = Combobox( self.bottomframe, values=['0%', '1%', '10%', '20%', '30%', '40%', '50%'], width=5) # create combobox to keep persantages self.combo.pack(side=LEFT) self.combo.current(0) self.analysisbtn = Button(self.bottomframe, text="Refine Analysis", width=30, height=2, command=self.refine_analysis) self.analysisbtn.pack(side=LEFT) for i in sorted( self.appdata.districts): # to append all districts in listbox self.listbox.insert(END, i)
def _make_button_bar(self): self.button_upload = Button(self, text="Flash code", command=self.upload) self.button_upload.style = self.style self.button_upload.grid(row=0, column=0, padx=2, pady=2) self.baud_rate = 9600 self.button_combobox = Combobox(self) self.button_combobox.bind("<<ComboboxSelected>>", self._update_baud_rate) bauds = (300, 1200, 2400, 4800, 9600, 14400, 19200, 28800, 38400, 57600, 115200) self.button_combobox['values'] = bauds self.button_combobox.current(4) self.button_combobox.grid(row=3, column=1, padx=2, pady=2)
def label_1to1_text_combobox(self, name="", values=("1", "2"), default_Chosen=0, width=10): self.vb_name.append(name.split()[0]) self.all_comp.append(Label(self.master, text=name)) #self.all_comp[-1].pack(anchor='w') self.all_comp[-1].grid(row=self.row, sticky=E) # self.get_comp.append(StringVar(self.master, values[default_Chosen])) self.all_comp.append( Combobox(self.master, width=width, textvariable=self.get_comp[-1])) #self.all_comp[-1].pack() self.all_comp[-1]['values'] = values self.all_comp[-1].current(default_Chosen) self.all_comp[-1].grid(row=self.row, column=1, sticky=W) # self.row += 1 #
def setPerfil(self, name): global img img_ = Image.open("Images/profile.png") img_.thumbnail((80, 80), Image.ANTIALIAS) img = ImageTk.PhotoImage(img_) Label(self.frameMenu, foreground="#66CD00", background="#B4CDCD", font=("Arial", 12, "bold"), image=img, compound=LEFT).pack(side=LEFT) self.cb = Combobox(self.frameMenu, width=18) self.cb.pack(side=LEFT, fill=X) values = ("Israel Gomes", "Andreza Dantas", "Sandra Noronha") self.cb.config(value=values) self.cb.config(state="readonly", style="C.TCombobox") self.cb.set(values[0])
def __init__(self,root,gua64): self.cntoint={u'少阳-----':'1',u'少阴-- --':'2',u'老阳--O--':'3',u'老阴--X--':'4'} self.tfont=tkFont.Font(family='Fixdsys',size=25,weight=tkFont.BOLD) self.gfont=tkFont.Font(family='Fixdsys',size=13,weight=tkFont.BOLD) self.dgua=[] #动爻 self.ygua=[] #原始卦 self.bbgua=[] #变卦 self.yguastr=[] #原始卦 self.gua=[] #只有12的卦 self.pabout=True #右键显示消失淮南标题 self.guax=200 self.guay=100 self.liushen={'甲':0,'乙':0,'丙':1,'丁':1,'戊':2,'己':3,'庚':4,'辛':4,'壬':5,'癸':5} self.liushencn=['青龙','朱雀','勾陈','腾蛇','白虎','玄武'] self.tiangan={'甲':1,'乙':2,'丙':3,'丁':4,'戊':5,'己':6,'庚':7,'辛':8,'壬':9,'癸':10} self.dizhi={'子':1,'丑':2,'寅':3,'卯':4,'辰':5,'巳':6,'午':7,'未':8,'申':9,'酉':10,'戌':11,'亥':12} self.kongwangzu=['子','丑','寅','卯','辰','巳','午','未','申','酉','戌','亥'] self.root=root self.root.title(u'===六爻排盘===[淮南内部专用]') self.root.minsize(550,380) self.root.maxsize(550,380) self.canvas=Canvas(root,width=460,height=380,bg='gray') # self.picyang=PhotoImage(file='tk\\yang.gif') # self.picyin=PhotoImage(file='tk\\yin.gif') self.canvas.place(relx=0,rely=0) self.com={} for i in xrange(6): self.com[i]=Combobox(root,state='readonly') self.com[i]['values']=(u'少阳-----',u'少阴-- --',u'老阳--O--',u'老阴--X--') self.com[i].current(0) self.com[i].place(relx=0.85,rely=0.36-0.07*i,width=80) bt1=Button(self.root,text=u'排盘',command=self.paipan) bt2=Button(self.root,text=u'清除',command=self.cls) l1=Label(self.root,text=u'右键水印') l1.place(x=480,y=327) # bt1.place(relx=0.85,rely=0.35+0.7) # bt1.pack(side='right') bt1.place(x=467,y=170,width=78) bt2.place(x=467,y=350,width=78) self.date() #干支 #=========================== self.root.bind('<Button-3>',self.about)
def create_ingredient_fields(self, frame, rownum): if rownum not in self.ingredients_info['ingredients'][1]: self.ingredients_info['ingredients'][1][rownum] = [None, None] ing_frame = LabelFrame(frame, text="Ingredient %s" % (rownum + 1)) ing_frame.grid(row=rownum, column=0, padx=10, pady=10, sticky=N+S+W+E) ing_frame.grid_rowconfigure(0, weight=1) ing_frame.grid_columnconfigure(0, weight=1) ing_frame.grid_columnconfigure(1, weight=10) space_label = Label(ing_frame, text="") space_label.grid(row=0, column=0, pady=5, sticky=W) name_label = Label(ing_frame, text="Ingredient Name") name_label.grid(row=1, column=0, columnspan=2, padx=10, pady=2, sticky=W) name_value = StringVar() if rownum in self.ingredients_info['ingredients'][0]: name_value.set(self.ingredients_info['ingredients'][0][rownum][0]) name_box = Entry(ing_frame, textvariable=name_value) name_box.grid(row=2, column=0, columnspan=2, padx=10, pady=2, sticky=W) param_label = Label(ing_frame, text="Ingredient Parameters") param_label.grid(row=3, column=0, columnspan=2, padx=10, pady=2, sticky=W) key_option_val = StringVar(ing_frame) key_option_val.set(self.keywords[0][0]) key_option_menu = Combobox(ing_frame, textvariable=key_option_val, state='readonly') key_option_menu['values'] = [key for key, value in self.keywords] key_option_menu.grid(row=4, column=0, sticky=W, pady=10, padx=10) add_key_btn = Button(ing_frame, text="+") add_key_btn.grid(row=4, column=1, padx=10, pady=10, sticky=W) self.key_boxes[rownum] = key_option_val param_box = Text(ing_frame, height=5, width=80) if rownum in self.ingredients_info['ingredients'][0]: param_box.insert('1.0', self.ingredients_info['ingredients'][0][rownum][1]) param_box.grid(row=5, column=0, columnspan=2, padx=10, pady=2, sticky=W) space_label = Label(ing_frame, text="") space_label.grid(row=5, column=0, pady=5, sticky=W) add_key_btn.configure(command=lambda:self.add_param_text(param_box, key_option_val)) self.ingredients_info['ingredients'][1][rownum] = [name_value, param_box]
def createBitFrame(self, bit): inpCardBitFrm = Frame(self.inpCardFrm, borderwidth = 5, relief=RAISED) self.bitFrms.append(inpCardBitFrm) if (bit < TkInpBrd.BITS_IN_ROW): inpCardBitFrm.grid(column = TkInpBrd.BITS_IN_ROW - bit - 1, row = 0) else: inpCardBitFrm.grid(column = rs232Intf.NUM_INP_PER_BRD - bit - 1, row = 1) tmpLbl = Label(inpCardBitFrm, text="%s" % GameData.InpBitNames.INP_BRD_BIT_NAMES[self.brdNum][bit]) tmpLbl.grid(column = 0, row = 0, columnspan = 2) #Read config and set btnCfg if (GameData.InpBitNames.INP_BRD_CFG[self.brdNum][bit] == rs232Intf.CFG_INP_STATE): self.btnCfgBitfield |= (1 << bit) #Combobox menu for button presses self.indBitOptMenu.append(StringVar()) if (self.btnCfgBitfield & (1 << bit)): self.indBitOptMenu[bit].set("Toggle") else: self.indBitOptMenu[bit].set("Pulse") tmpCB = Combobox(inpCardBitFrm, textvariable=self.indBitOptMenu[bit], width=6, state="readonly") tmpCB["values"] = ("Pulse", "Toggle") tmpCB.grid(column = 0, row = 1, columnspan = 2) self.indBitOptMenu[bit].trace("w", lambda name, index, op, tmp=bit: self.comboboxcallback(tmp)) #Button code if (self.btnCfgBitfield & (1 << bit)): #Toggle button so use the old style so button can stay pressed tmpBtn = Btn(inpCardBitFrm, text="SimSwitch", command=lambda tmp=bit: self.toggle(tmp)) tmpBtn.grid(column = 0, row = 2, columnspan = 2, padx=8, pady=8) else: #Pulse button so use the new style tmpBtn = Button(inpCardBitFrm, text="SimSwitch", command=lambda tmp=bit: self.toggle(tmp)) tmpBtn.grid(column = 0, row = 2, columnspan = 2, padx=4, pady=12) self.toggleBtn.append(tmpBtn) self.toggleState.append(False) tmpLbl = Label(inpCardBitFrm, text="Value") tmpLbl.grid(column = 0, row = 3) self.indBitStatLbl.append(StringVar()) self.indBitStatLbl[bit].set("0") tmpLbl = Label(inpCardBitFrm, textvariable=self.indBitStatLbl[bit], relief=SUNKEN) tmpLbl.grid(column = 1, row = 3)
def init_ui(self): self.parent_.title('Rough surface generator') self.pack(fill=BOTH, expand=True) # top panel with controls frame_top = Frame(self, background=self.TOP_FRAME_BACKGROUND_COLOR) frame_top.pack(fill=X) self.cb = Combobox(frame_top, values=('Gaussian', 'Laplace')) self.cb.current(0) self.cb.pack(side=LEFT, padx=5, expand=True) l1 = Label(frame_top, text=r'Cx', background=self.TOP_FRAME_BACKGROUND_COLOR, width=4) l1.pack(side=LEFT, padx=5, expand=True) self.entry1 = Entry(frame_top, validate='key', validatecommand=(self.register(self.on_validate), '%d', '%i', '%P', '%s', '%S', '%v', '%V', '%W'), width=10) self.entry1.pack(side=LEFT, padx=5, expand=True) self.entry1.insert(0, str(self.a_)) l1 = Label(frame_top, text=r'Cy', width=4, background=self.TOP_FRAME_BACKGROUND_COLOR) l1.pack(side=LEFT, padx=5) self.entry2 = Entry(frame_top, validate='key', validatecommand=(self.register(self.on_validate), '%d', '%i', '%P', '%s', '%S', '%v', '%V', '%W'), width=10) self.entry2.pack(side=LEFT, padx=5, expand=True) self.entry2.insert(0, str(self.b_)) but1 = Button(frame_top, text='RUN', command=self.button_action) but1.pack(side=RIGHT, padx=5, pady=5) # central panel. It will have a label with an image. Image may have a random noise state, or # transformed image state self.img_frame.pack(fill=BOTH, expand=True) img_label = Label(self.img_frame, background=None) img_label.pack(expand=True, fill=BOTH, padx=5, pady=5)
def body(self, master): """Creates select game window. :param master: instance - master widget instance :return: Entry instance """ self.resizable(False, False) Label(master, text='Type in new game title or select existing one').grid(row=0, columnspan=2) Label(master, text='Select game:').grid(row=1, sticky='W') Label(master, text='Number of players:').grid(row=2, sticky='W') Label(master, text='Game duration:').grid(row=3, sticky='W') self.select_game = Combobox(master) self.select_game.bind('<Button-1>', self.refresh_games) self.select_game.grid(row=1, column=1, sticky='W') self.num_players = Entry(master) self.num_players.insert(END, self.parent.num_players if self.parent.num_players else '') self.num_players.grid(row=2, column=1, sticky='W') self.num_turns = Entry(master) self.num_turns.insert(END, self.parent.num_turns if self.parent.num_turns else '') self.num_turns.grid(row=3, column=1, sticky='W') return self.select_game
def make_bottom_right(parent): try: # If the ttk combo-box widget is available, use it for the # Types field. Otherwise, create one out of other Tk widgets. from ttk import Combobox itypes = [ ' ' + t for t in cap_item_types ] self.type_ent = Combobox(parent, values=itypes, width=(query_entry_width - 6), height=len(itypes)) self.ttk_type_entry = 1 return self.type_ent except: self.ttk_type_entry = 0 # ttk not present bottom_right = Frame(parent) self.type_ent = entry_widget(bottom_right, width=(query_entry_width - 6)) self.type_ent.pack(side=LEFT, fill=X, expand=YES) self.types_pulldown_button = \ Button(bottom_right, text=u_triagdn, pady=0, anchor=S, command=EventHandler('Display file type list', self.types_pull_down)) self.types_pulldown_button.pack(side=LEFT, padx=2) return bottom_right
def __init__(self, parent, controller): Frame.__init__(self, parent) global info, tree #VARIABLES info = IntVar() #WIDGETS #========================= HEADER =========================== self.header = Label(self, text="ADMINISTRADOR DE DOCUMENTOS", font="bold") self.header.pack(pady=20, side=TOP) #========================= WRAPPER 1 =========================== self.wrapper = Frame (self) self.wrapper.pack(side=LEFT, fill=Y) #======================== DOCUMENTOS DE ======================== self.f0 = Frame(self.wrapper) self.f0.pack(pady=5,fill=X)#------------------------------------ self.lf1 = LabelFrame(self.f0, text="Documentos de")#----------> self.f1 = Frame(self.lf1) self.f1.pack(pady=5, side=LEFT) self.pR1 = Radiobutton(self.f1, text="Propietario", variable=info, value=1, command=select) self.pR1.grid(row=0, column=0, sticky=W) self.aR2 = Radiobutton (self.f1, text="Arrendatario", variable=info, value=2, command=select) self.aR2.grid(row=1, column=0, sticky=W) self.tR3 = Radiobutton (self.f1, text="Tercero", variable=info, value=3, command=select) self.tR3.grid(row=2, column=0, sticky=W) self.lf1.pack(side=LEFT)#<-------------------------------------- #====================== FECHAS DE BÚSQUEDA ===================== self.lf2 = LabelFrame(self.f0, text="Fechas de búsqueda")#------> self.f2 = Frame(self.lf2) self.f2.pack(pady=5)#--------------------------- self.deL = Label(self.f2, text='De:') self.deL.pack(side=LEFT) self.deCbx = Combobox(self.f2, width=32) self.deCbx.set('') self.deCbx.pack(side=LEFT) self.f3 = Frame(self.lf2) self.f3.pack(pady=5)#--------------------------- self.hastaL = Label(self.f3, text='Hasta:') self.hastaL.pack(side=LEFT) self.hastaCbx = Combobox(self.f3, width=30) self.hastaCbx.set('') self.hastaCbx.pack(side=LEFT) self.lf2.pack(side=LEFT, fill=X)#<--------------------------- #========================= WRAPPER 2 =========================== self.wrapper2 = Frame (self.wrapper) self.wrapper2.pack(pady=5,fill=X) #========================= BENEFICIARIO ======================== self.box1 = Frame(self.wrapper2) self.box1.pack(side=LEFT) #--------------------------------------------------------------- self.f4 = Frame(self.box1) self.f4.pack() self.l1 = Label(self.f4, text="Beneficiario") self.l1.pack() tree = Treeview(self.f4, height=7, show="headings", columns=('col1','col2')) tree.pack(side=LEFT, fill=X, expand=1) tree.column('col1', width=100, anchor='center') tree.column('col2', width=180, anchor='center') tree.heading('col1', text='CC') tree.heading('col2', text='Nombres') self.scroll = Scrollbar(self.f4,orient=VERTICAL,command=tree.yview) tree.configure(yscrollcommand=self.scroll.set) self.f5 = Frame(self.box1)#---------------------------------- self.f5.pack() self.lf3 = LabelFrame(self.f5, text="Factura Propietario")#----> self.e1 = Entry(self.lf3, width=12).pack(side=LEFT) self.anularCk = Checkbutton(self.lf3, text="Anular").pack(side=LEFT) self.viewB = Button(self.lf3, text='Visualizar').pack(side=LEFT) self.lf3.pack(side=LEFT)#<-------------------------------------- #========================== FACTURAS ========================== self.box2 = Frame(self.wrapper2) self.box2.pack(side=LEFT) #--------------------------------------------------------------- self.f6 = Frame(self.box2) self.f6.pack() self.l2 = Label(self.f6, text="Facturas") self.l2.pack() self.tree = Treeview(self.f6, height=7, show="headings", columns=('col1','col2')) self.tree.pack(side=LEFT, fill=X, expand=1) self.tree.column('col1', width=100, anchor='center') self.tree.column('col2', width=100, anchor='center') self.tree.heading('col1', text='Número') self.tree.heading('col2', text='Valor') self.scroll = Scrollbar(self.f6,orient=VERTICAL,command=self.tree.yview) self.tree.configure(yscrollcommand=self.scroll.set) self.f7 = Frame(self.box2)#---------------------------------- self.f7.pack() self.lf4 = LabelFrame(self.f7, text="Factura Arrendatario")#----> self.e1 = Entry(self.lf4, width=12).pack(side=LEFT) self.anularCk = Checkbutton(self.lf4, text="Anular").pack(side=LEFT) self.viewB = Button(self.lf4, text='Ver', width=5).pack(side=LEFT) self.lf4.pack(side=LEFT)#<-------------------------------------- #========================== RECIBOS ========================== self.box3 = Frame(self.wrapper2) self.box3.pack(side=LEFT) #--------------------------------------------------------------- self.f8 = Frame(self.box3) self.f8.pack() self.l3 = Label(self.f8, text="Recibos de caja") self.l3.pack() self.tree = Treeview(self.f8, height=7, show="headings", columns=('col1','col2')) self.tree.pack(side=LEFT, fill=X, expand=1) self.tree.column('col1', width=100, anchor='center') self.tree.column('col2', width=100, anchor='center') self.tree.heading('col1', text='Número') self.tree.heading('col2', text='Valor') self.scroll = Scrollbar(self.f8,orient=VERTICAL,command=self.tree.yview) self.tree.configure(yscrollcommand=self.scroll.set) self.f9 = Frame(self.box3)#---------------------------------- self.f9.pack() self.lf5 = LabelFrame(self.f9, text="Recibos de caja")#----> self.e1 = Entry(self.lf5, width=12).pack(side=LEFT) self.anularCk = Checkbutton(self.lf5, text="Anular").pack(side=LEFT) self.viewB = Button(self.lf5, text='Ver', width=5).pack(side=LEFT) self.lf5.pack(side=LEFT)#<-------------------------------------- #===================== COMPROBANTE DE PAGO ===================== self.box4 = Frame(self.wrapper2) self.box4.pack(side=LEFT) #--------------------------------------------------------------- self.f10 = Frame(self.box4) self.f10.pack() self.l4 = Label(self.f10, text="Comprobantes de pago") self.l4.pack() self.tree = Treeview(self.f10, height=7, show="headings", columns=('col1','col2')) self.tree.pack(side=LEFT, fill=X, expand=1) self.tree.column('col1', width=100, anchor='center') self.tree.column('col2', width=100, anchor='center') self.tree.heading('col1', text='Número') self.tree.heading('col2', text='Valor') self.scroll = Scrollbar(self.f10,orient=VERTICAL,command=self.tree.yview) self.tree.configure(yscrollcommand=self.scroll.set) self.f11 = Frame(self.box4)#---------------------------------- self.f11.pack() self.lf6 = LabelFrame(self.f11, text="Pagos")#----> self.e1 = Entry(self.lf6, width=12).pack(side=LEFT) self.anularCk = Checkbutton(self.lf6, text="Anular").pack(side=LEFT) self.viewB = Button(self.lf6, text='Ver', width=5).pack(side=LEFT) self.lf6.pack(side=LEFT)#<--------------------------------------