Python tkinter.Button() Examples
The following are 30
code examples of tkinter.Button().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
tkinter
, or try the search function
.

Example #1
Source File: window.py From LPHK with GNU General Public License v3.0 | 8 votes |
def popup(self, window, title, image, text, button_text, end_command=None): popup = tk.Toplevel(window) popup.resizable(False, False) if MAIN_ICON != None: if os.path.splitext(MAIN_ICON)[1].lower() == ".gif": dummy = None #popup.call('wm', 'iconphoto', popup._w, tk.PhotoImage(file=MAIN_ICON)) else: popup.iconbitmap(MAIN_ICON) popup.wm_title(title) popup.tkraise(window) def run_end(): popup.destroy() if end_command != None: end_command() picture_label = tk.Label(popup, image=image) picture_label.photo = image picture_label.grid(column=0, row=0, rowspan=2, padx=10, pady=10) tk.Label(popup, text=text, justify=tk.CENTER).grid(column=1, row=0, padx=10, pady=10) tk.Button(popup, text=button_text, command=run_end).grid(column=1, row=1, padx=10, pady=10) popup.wait_visibility() popup.grab_set() popup.wait_window()
Example #2
Source File: viewer.py From networkx_viewer with GNU General Public License v3.0 | 7 votes |
def __init__(self, main_window, msg='Please enter a node:'): tk.Toplevel.__init__(self) self.main_window = main_window self.title('Node Entry') self.geometry('170x160') self.rowconfigure(3, weight=1) tk.Label(self, text=msg).grid(row=0, column=0, columnspan=2, sticky='NESW',padx=5,pady=5) self.posibilities = [d['dataG_id'] for n,d in main_window.canvas.dispG.nodes_iter(data=True)] self.entry = AutocompleteEntry(self.posibilities, self) self.entry.bind('<Return>', lambda e: self.destroy(), add='+') self.entry.grid(row=1, column=0, columnspan=2, sticky='NESW',padx=5,pady=5) tk.Button(self, text='Ok', command=self.destroy).grid( row=3, column=0, sticky='ESW',padx=5,pady=5) tk.Button(self, text='Cancel', command=self.cancel).grid( row=3, column=1, sticky='ESW',padx=5,pady=5) # Make modal self.winfo_toplevel().wait_window(self)
Example #3
Source File: client-test2.py From The-chat-room with MIT License | 6 votes |
def video_invite_window(message, inviter_name): invite_window = tkinter.Toplevel() invite_window.geometry('300x100') invite_window.title('Invitation') label1 = tkinter.Label(invite_window, bg='#f0f0f0', width=20, text=inviter_name) label1.pack() label2 = tkinter.Label(invite_window, bg='#f0f0f0', width=20, text='invites you to video chat!') label2.pack() def accept_invite(): invite_window.destroy() video_accept(message[message.index('INVITE') + 6:]) def refuse_invite(): invite_window.destroy() Refuse = tkinter.Button(invite_window, text="Refuse", command=refuse_invite) Refuse.place(x=60, y=60, width=60, height=25) Accept = tkinter.Button(invite_window, text="Accept", command=accept_invite) Accept.place(x=180, y=60, width=60, height=25)
Example #4
Source File: client.py From The-chat-room with MIT License | 6 votes |
def video_invite_window(message, inviter_name): invite_window = tkinter.Toplevel() invite_window.geometry('300x100') invite_window.title('Invitation') label1 = tkinter.Label(invite_window, bg='#f0f0f0', width=20, text=inviter_name) label1.pack() label2 = tkinter.Label(invite_window, bg='#f0f0f0', width=20, text='invites you to video chat!') label2.pack() def accept_invite(): invite_window.destroy() video_accept(message[message.index('INVITE') + 6:]) def refuse_invite(): invite_window.destroy() Refuse = tkinter.Button(invite_window, text="Refuse", command=refuse_invite) Refuse.place(x=60, y=60, width=60, height=25) Accept = tkinter.Button(invite_window, text="Accept", command=accept_invite) Accept.place(x=180, y=60, width=60, height=25)
Example #5
Source File: toolkit.py From PickTrue with MIT License | 6 votes |
def __init__(self, master=None, store_name=None, **kwargs): super(FileBrowse, self).__init__(master=master, **kwargs) self.label_text = tk.StringVar() btn = tk.Button(self, text="下载到", command=self.choose_file) btn.pack( side=tk.LEFT, ) tk.Label(self, textvariable=self.label_text).pack( side=tk.LEFT, fill=tk.X, ) self.pack(fill=tk.X) self._store_name = store_name if store_name is not None: self._config = config_store save_path = self._config.op_read_path(store_name) or get_working_dir() else: self._config = None save_path = get_working_dir() self.label_text.set( save_path )
Example #6
Source File: downloader.py From PickTrue with MIT License | 6 votes |
def build_buttons(self): btn_args = dict( height=1, ) btn_group = tk.Frame(self) buttons = [ tk.Button( btn_group, text=text, command=command, **btn_args ) for text, command in ( ("开始下载", self.start_download), ("停止下载", self.stop_download), ("打开下载文件夹", self.open_download_folder), ) ] for index, btn in enumerate(buttons): btn.grid(column=index, row=0, sticky=tk.N) btn_group.pack(fill=tk.BOTH, expand=1) return btn_group
Example #7
Source File: downloader.py From PickTrue with MIT License | 6 votes |
def build_buttons(self): btn_args = dict( height=1, ) btn_group = tk.Frame(self) buttons = [ tk.Button( btn_group, text=text, command=command, **btn_args ) for text, command in ( ("开始下载", self.start_download), ("停止下载", self.stop_download), ("打开下载文件夹", self.open_download_folder), ) ] for index, btn in enumerate(buttons): btn.grid(column=index, row=0, sticky=tk.N) btn_group.pack(fill=tk.BOTH, expand=1) return btn_group
Example #8
Source File: ch4.py From Tkinter-GUI-Programming-by-Example with MIT License | 6 votes |
def __init__(self): super().__init__() self.title("Blackjack") self.geometry("800x640") self.resizable(False, False) self.bottom_frame = tk.Frame(self, width=800, height=140, bg="red") self.bottom_frame.pack_propagate(0) self.hit_button = tk.Button(self.bottom_frame, text="Hit", width=25, command=self.hit) self.stick_button = tk.Button(self.bottom_frame, text="Stick", width=25, command=self.stick) self.next_round_button = tk.Button(self.bottom_frame, text="Next Round", width=25, command=self.next_round) self.quit_button = tk.Button(self.bottom_frame, text="Quit", width=25, command=self.destroy) self.new_game_button = tk.Button(self.bottom_frame, text="New Game", width=25, command=self.new_game) self.bottom_frame.pack(side=tk.BOTTOM, fill=tk.X) self.game_screen = GameScreen(self, bg="white", width=800, height=500) self.game_screen.pack(side=tk.LEFT, anchor=tk.N) self.game_screen.setup_opening_animation()
Example #9
Source File: ch1-6.py From Tkinter-GUI-Programming-by-Example with MIT License | 6 votes |
def __init__(self): super().__init__() self.title("Hello Tkinter") self.label_text = tk.StringVar() self.label_text.set("My Name Is: ") self.name_text = tk.StringVar() self.label = tk.Label(self, textvar=self.label_text) self.label.pack(fill=tk.BOTH, expand=1, padx=100, pady=10) self.name_entry = tk.Entry(self, textvar=self.name_text) self.name_entry.pack(fill=tk.BOTH, expand=1, padx=20, pady=20) hello_button = tk.Button(self, text="Say Hello", command=self.say_hello) hello_button.pack(side=tk.LEFT, padx=(20, 0), pady=(0, 20)) goodbye_button = tk.Button(self, text="Say Goodbye", command=self.say_goodbye) goodbye_button.pack(side=tk.RIGHT, padx=(0, 20), pady=(0, 20))
Example #10
Source File: Emotion Recognition.py From Emotion-Recognition-Using-SVMs with MIT License | 6 votes |
def record_result(self, smile=True): print "Image", self.index + 1, ":", "Happy" if smile is True else "Sad" self.results[str(self.index)] = smile # =================================== # Callback function for the buttons # =================================== ## smileCallback() : Gets called when "Happy" Button is pressed ## noSmileCallback() : Gets called when "Sad" Button is pressed ## updateImageCount() : Displays the number of images processed ## displayFace() : Gets called internally by either of the button presses ## displayBarGraph(isBarGraph) : computes the bar graph after classification is completed 100% ## _begin() : Resets the Dataset & Starts from the beginning ## _quit() : Quits the Application ## printAndSaveResult() : Save and print the classification result ## loadResult() : Loading the previously stored classification result ## run_once(m) : Decorator to allow functions to run only once
Example #11
Source File: tk.py From Jtyoui with MIT License | 6 votes |
def ui(): root = tkinter.Tk() root.title('PDF和照片互转器') # 标题 root.resizable(width=False, height=False) # 防止大小调整 canvas = tkinter.Canvas(root, width=450, height=320, highlightthickness=0) # 创建画布 photo = tkinter.PhotoImage(file=file_zip_path + os.sep + 'pdf.png') # 获取背景图片的网络连接 canvas.create_image(225, 160, image=photo) select_dir_button = tkinter.Button(root, text="选择照片文件夹", command=select_dir, bg='yellow') # 创建按钮 select_pdf_button = tkinter.Button(root, text="选择PDF文件", command=select_pdf, bg='green') click_button = tkinter.Button(root, text="点击执行", command=start, bg='blue') select_dir_button.pack() # 启动按钮 select_pdf_button.pack() click_button.pack() canvas.create_window(240, 120, width=100, height=30, window=select_dir_button) # 将按钮创建到画布 canvas.create_window(240, 190, width=100, height=30, window=select_pdf_button) canvas.create_window(240, 260, width=100, height=30, window=click_button) canvas.pack() # 启动画布 root.mainloop() # 主程序循环
Example #12
Source File: base.py From mentalist with MIT License | 6 votes |
def add_attr(self, attr_name, right_label_text=None, *args): '''Add attr to the lower frame with a '-' button & title attr_name: title to be shown on the left side right_label_text: label string to be shown on the right side, which is a word count or 'Calculating...' ''' if len(self.attrs) == 0: self.lower_frame = Frame(self) self.lower_frame.pack(side="bottom", fill="both") attr = LabeledFrame(self.lower_frame, title=attr_name) btn_add_file = Tk.Button(attr, text=' - ') btn_add_file.pack(fill="both", side="left", padx=10, pady=5) btn_add_file.bind("<ButtonRelease-1>", partial(self.on_remove_attr, attr)) lb_base_files = Tk.Label(attr, text=attr_name) lb_base_files.pack(fill="both", side="left", padx=10, pady=10) if right_label_text is not None: attr.right_label = Tk.Label(attr, text=right_label_text, font=('Helvetica', '10', 'italic')) attr.right_label.pack(fill="both", side="right", padx=10, pady=10) else: attr.right_label = None attr.pack(side="top", fill="both") self.attrs.append(attr)
Example #13
Source File: components.py From SEM with MIT License | 6 votes |
def __init__(self, root, main_window, button_opt): ttk.Frame.__init__(self, root) self.root = root self.main_window = main_window self.current_files = None self.button_opt = button_opt # define options for opening or saving a file self.file_opt = options = {} options['defaultextension'] = '.txt' options['filetypes'] = [('all files', '.*'), ('text files', '.txt')] options['initialdir'] = os.path.expanduser("~") options['parent'] = root options['title'] = 'Select files to annotate.' self.file_selector_button = ttk.Button(self.root, text=u"select file(s)", command=self.filenames) self.label = ttk.Label(self.root, text=u"selected file(s):") self.fa_search = tkinter.PhotoImage(file=os.path.join(self.main_window.resource_dir, "images", "fa_search_24_24.gif")) self.file_selector_button.config(image=self.fa_search, compound=tkinter.LEFT) self.scrollbar = ttk.Scrollbar(self.root) self.selected_files = tkinter.Listbox(self.root, yscrollcommand=self.scrollbar.set) self.scrollbar.config(command=self.selected_files.yview)
Example #14
Source File: lineSettingsFrame.py From PyEveLiveDPS with GNU General Public License v3.0 | 6 votes |
def addLine(self, settingsList, dpsFrame): lineNumber = len(settingsList) settingsList.append({"transitionValue": "", "color": "#FFFFFF"}) settingsList[lineNumber]["transitionValue"] = tk.StringVar() settingsList[lineNumber]["transitionValue"].set(str(100*lineNumber)) removeButton = tk.Button(dpsFrame, text="X", command=lambda:self.removeLine(lineNumber, settingsList, dpsFrame)) font = tkFont.Font(font=removeButton['font']) font.config(weight='bold') removeButton['font'] = font removeButton.grid(row=lineNumber, column="0") lineLabel = tk.Label(dpsFrame, text="Threshold when the line changes color:") lineLabel.grid(row=lineNumber, column="1") initialThreshold = tk.Entry(dpsFrame, textvariable=settingsList[lineNumber]["transitionValue"], width=10) initialThreshold.grid(row=lineNumber, column="2") initialLabel = tk.Label(dpsFrame, text="Color:") initialLabel.grid(row=lineNumber, column="3") colorButton = tk.Button(dpsFrame, text=" ", command=lambda:self.colorWindow(settingsList[lineNumber], colorButton), bg=settingsList[lineNumber]["color"]) colorButton.grid(row=lineNumber, column="4")
Example #15
Source File: cameraConfig.py From crappy with GNU General Public License v2.0 | 6 votes |
def create_inputs(self): settings = list(self.camera.settings_dict.keys()) settings.sort(key=lambda e: str(type(self.camera.settings[e].limits))) self.scales = {} self.radios = {} self.checks = {} i = 0 for i,k in enumerate(settings): s = self.camera.settings[k] if type(s.limits) == tuple: self.create_scale(s,i) elif type(s.limits) == bool: self.create_check(s,i) elif type(s.limits) == dict: self.create_radio(s,i) self.lower_frame = tk.Frame() self.lower_frame.grid(column=1,row=i+3) self.apply_button = tk.Button(self.lower_frame,text="Apply", command=self.apply_settings) self.apply_button.pack() #self.apply_button.grid(column=1,row=i+3)
Example #16
Source File: workflowcreator.py From CEASIOMpy with Apache License 2.0 | 6 votes |
def __init__(self, master=None, **kwargs): tk.Frame.__init__(self, master, **kwargs) self.pack(fill=tk.BOTH) self.Options = WorkflowOptions() space_label = tk.Label(self, text=' ') space_label.grid(column=0, row=0) # Input CPACS file self.label = tk.Label(self, text=' Input CPACS file') self.label.grid(column=0, row=1) self.path_var = tk.StringVar() self.path_var.set(self.Options.cpacs_path) value_entry = tk.Entry(self, textvariable=self.path_var, width= 45) value_entry.grid(column=1, row=1) self.browse_button = tk.Button(self, text="Browse", command=self._browse_file) self.browse_button.grid(column=2, row=1, pady=5) # Notebook for tabs self.tabs = ttk.Notebook(self) self.tabs.grid(column=0, row=2, columnspan=3,padx=10,pady=10) self.TabPre = Tab(self, 'Pre') self.TabOptim = Tab(self, 'Optim') self.TabPost = Tab(self, 'Post') self.tabs.add(self.TabPre, text=self.TabPre.name) self.tabs.add(self.TabOptim, text=self.TabOptim.name) self.tabs.add(self.TabPost, text=self.TabPost.name) # General buttons self.close_button = tk.Button(self, text='Save & Quit', command=self._save_quit) self.close_button.grid(column=2, row=3)
Example #17
Source File: window.py From LPHK with GNU General Public License v3.0 | 5 votes |
def ask_color(self, window, button, x, y, default_color): global colors_to_set if lp_mode == "Mk1": color = self.classic_askcolor(color=tuple(default_color), title="Select Color for Button (" + str(x) + ", " + str(y) + ")") else: color = tkcolorpicker.askcolor(color=tuple(default_color), parent=window, title="Select Color for Button (" + str(x) + ", " + str(y) + ")") if color[0] != None: color_to_set = [int(min(255, max(0, c))) for c in color[0]] if all(c < 4 for c in color_to_set): rerun = lambda: self.ask_color(window, button, x, y, default_color) self.popup(window, "Invalid Color", self.warning_image, "That color is too dark to see.", "OK", rerun) else: colors_to_set[x][y] = color_to_set self.button_color_with_text_update(button, color[1])
Example #18
Source File: client-test2.py From The-chat-room with MIT License | 5 votes |
def express(): global b1, b2, b3, b4, ee if ee == 0: ee = 1 b1 = tkinter.Button(root, command=bb1, image=p1, relief=tkinter.FLAT, bd=0) b2 = tkinter.Button(root, command=bb2, image=p2, relief=tkinter.FLAT, bd=0) b3 = tkinter.Button(root, command=bb3, image=p3, relief=tkinter.FLAT, bd=0) b4 = tkinter.Button(root, command=bb4, image=p4, relief=tkinter.FLAT, bd=0) b1.place(x=5, y=248) b2.place(x=75, y=248) b3.place(x=145, y=248) b4.place(x=215, y=248) else: ee = 0 b1.destroy() b2.destroy() b3.destroy() b4.destroy() # 创建表情按钮
Example #19
Source File: client.py From The-chat-room with MIT License | 5 votes |
def express(): global b1, b2, b3, b4, ee if ee == 0: ee = 1 b1 = tkinter.Button(root, command=bb1, image=p1, relief=tkinter.FLAT, bd=0) b2 = tkinter.Button(root, command=bb2, image=p2, relief=tkinter.FLAT, bd=0) b3 = tkinter.Button(root, command=bb3, image=p3, relief=tkinter.FLAT, bd=0) b4 = tkinter.Button(root, command=bb4, image=p4, relief=tkinter.FLAT, bd=0) b1.place(x=5, y=248) b2.place(x=75, y=248) b3.place(x=145, y=248) b4.place(x=215, y=248) else: ee = 0 b1.destroy() b2.destroy() b3.destroy() b4.destroy() # 创建表情按钮
Example #20
Source File: client-test.py From The-chat-room with MIT License | 5 votes |
def express(): global b1, b2, b3, b4, ee if ee == 0: ee = 1 b1 = tkinter.Button(root, command=bb1, image=p1, relief=tkinter.FLAT, bd=0) b2 = tkinter.Button(root, command=bb2, image=p2, relief=tkinter.FLAT, bd=0) b3 = tkinter.Button(root, command=bb3, image=p3, relief=tkinter.FLAT, bd=0) b4 = tkinter.Button(root, command=bb4, image=p4, relief=tkinter.FLAT, bd=0) b1.place(x=5, y=248) b2.place(x=75, y=248) b3.place(x=145, y=248) b4.place(x=215, y=248) else: ee = 0 b1.destroy() b2.destroy() b3.destroy() b4.destroy() # 创建表情按钮
Example #21
Source File: 3_tklabel_and_btn.py From deep-learning-note with MIT License | 5 votes |
def __init__(self, *args, **kwargs): self.modify_button = kwargs["modify_button"] del kwargs["modify_button"] # So that it isn't passed to tkinter.Button, as that will give an 'unknown option' error. kwargs["command"] = lambda: change_text(self.modify_button, self.cget("text")) # Overrinding command. tkinter.Button.__init__(self, *args, **kwargs)
Example #22
Source File: wicc_view_dos.py From WiCC with GNU General Public License v3.0 | 5 votes |
def build_window(self): """ Generates the window. :author: Pablo Sanz Alguacil """ self.root = Toplevel() self.root.geometry('310x200') self.root.resizable(width=False, height=False) self.root.title('DoS Attack') self.root.protocol("WM_DELETE_WINDOW", self.destroy_window) self.labelframe_info = LabelFrame(self.root) self.labelframe_info.pack(fill="both", expand="no", pady=15) self.label_info = Label(self.labelframe_info, pady=15, text="With this tool yo can perform a DoS Attack." "\n\nIntroduce the attack's duration in seconds." "\nIntroduce 0 for infite time attack." "\nWait until the tool finishes the attack. ") self.label_info.pack() self.labelframe_buttons = LabelFrame(self.root) self.labelframe_buttons.pack(fill="both", expand="no", pady=5) self.label_time = Label(self.labelframe_buttons, text="Time: ") self.label_time.grid(column=0, row=0, padx=5, pady=5) self.entry = ttk.Entry(self.labelframe_buttons) self.entry.grid(column=1, row=0, padx=5, pady=5) self.button_start = Button(self.labelframe_buttons, text="Start", command=self.start_dos) self.button_start.grid(column=2, row=0, padx=5, pady=5)
Example #23
Source File: wicc_view_about.py From WiCC with GNU General Public License v3.0 | 5 votes |
def build_window(self): """ Generates the window. :author: Pablo Sanz Alguacil """ self.root = Toplevel() self.root.geometry('460x300') self.root.resizable(width=False, height=False) self.root.title('About') # LABEL - INFO self.label_info = Label(self.root, pady=15, text="Developed as the Group Project for 3rd year of the Bachelor " "\nof Science in Computing in Digital Forensics and Cyber Security " "\nat the Technological University Dublin." "\n") self.label_info.pack() self.button = Button(self.root, text="Project page", command=self.open_link) self.button.pack() self.frame = Frame(self.root) self.frame.pack() photo = PhotoImage(file=self.logo) photo_label = Label(self.frame, image=photo) photo_label.image = photo photo_label.pack(side=LEFT) self.label_collaborators = Label(self.frame, text="\tPablo Sanz Alguacil (Code)" "\n\tMiguel Yanes Fernández (Code)" "\n\tAdam Chalkley (Research)") self.label_collaborators.pack(side=RIGHT)
Example #24
Source File: ch3.py From Tkinter-GUI-Programming-by-Example with MIT License | 5 votes |
def __init__(self): super().__init__() self.title("Blackjack") self.geometry("800x640") self.resizable(False, False) self.CARD_ORIGINAL_POSITION = 100 self.CARD_WIDTH_OFFSET = 100 self.PLAYER_CARD_HEIGHT = 300 self.DEALER_CARD_HEIGHT = 100 self.PLAYER_SCORE_TEXT_COORDS = (400, 450) self.WINNER_TEXT_COORDS = (400, 250) self.game_state = GameState() self.game_screen = tk.Canvas(self, bg="white", width=800, height=500) self.bottom_frame = tk.Frame(self, width=800, height=140, bg="red") self.bottom_frame.pack_propagate(0) self.hit_button = tk.Button(self.bottom_frame, text="Hit", width=25, command=self.hit) self.stick_button = tk.Button(self.bottom_frame, text="Stick", width=25, command=self.stick) self.play_again_button = tk.Button(self.bottom_frame, text="Play Again", width=25, command=self.play_again) self.quit_button = tk.Button(self.bottom_frame, text="Quit", width=25, command=self.destroy) self.hit_button.pack(side=tk.LEFT, padx=(100, 200)) self.stick_button.pack(side=tk.LEFT) self.bottom_frame.pack(side=tk.BOTTOM, fill=tk.X) self.game_screen.pack(side=tk.LEFT, anchor=tk.N) self.display_table()
Example #25
Source File: ch1-5.py From Tkinter-GUI-Programming-by-Example with MIT License | 5 votes |
def __init__(self): super().__init__() self.title("Hello Tkinter") self.label_text = tk.StringVar() self.label_text.set("Choose One") self.label = tk.Label(self, textvar=self.label_text) self.label.pack(fill=tk.BOTH, expand=1, padx=100, pady=30) hello_button = tk.Button(self, text="Say Hello", command=self.say_hello) hello_button.pack(side=tk.LEFT, padx=(20, 0), pady=(0, 20)) goodbye_button = tk.Button(self, text="Say Goodbye", command=self.say_goodbye) goodbye_button.pack(side=tk.RIGHT, padx=(0, 20), pady=(0, 20))
Example #26
Source File: ch1-3.py From Tkinter-GUI-Programming-by-Example with MIT License | 5 votes |
def __init__(self): super().__init__() self.title("Hello Tkinter") self.label_text = tk.StringVar() self.label_text.set("Choose One") self.label = tk.Label(self, textvar=self.label_text) self.label.pack(fill=tk.BOTH, expand=1, padx=100, pady=30) hello_button = tk.Button(self, text="Say Hello", command=self.say_hello) hello_button.pack(side=tk.LEFT, padx=(20, 0), pady=(0, 20)) goodbye_button = tk.Button(self, text="Say Goodbye", command=self.say_goodbye) goodbye_button.pack(side=tk.RIGHT, padx=(0, 20), pady=(0, 20))
Example #27
Source File: ch1-2.py From Tkinter-GUI-Programming-by-Example with MIT License | 5 votes |
def __init__(self): super().__init__() self.title("Hello Tkinter") self.label = tk.Label(self, text="Choose One") self.label.pack(fill=tk.BOTH, expand=1, padx=100, pady=30) hello_button = tk.Button(self, text="Say Hello", command=self.say_hello) hello_button.pack(side=tk.LEFT, padx=(20, 0), pady=(0, 20)) goodbye_button = tk.Button(self, text="Say Goodbye", command=self.say_goodbye) goodbye_button.pack(side=tk.RIGHT, padx=(0, 20), pady=(0, 20))
Example #28
Source File: ui_launch.py From Andromeda with MIT License | 5 votes |
def __make_select_text(self, frame, row, column, tag, text, sele=True): entry = tk.Entry(frame, width=35, textvariable=text) entry.grid(row=row, column=column) if sele: button = tk.Button(frame, text='选择', width=10,) button.grid(row=row, column=column + 1) button['command'] = (lambda: self.__click_select(entry, tag))
Example #29
Source File: ui_launch.py From Andromeda with MIT License | 5 votes |
def __make_select_confirm(self, frame, row, column): button = tk.Button(frame, width=15, text='开启自动打包') button.grid(row=row, column=column) button['command'] = (lambda: self.__click_browser())
Example #30
Source File: ui_input.py From Andromeda with MIT License | 5 votes |
def __make_select_text(self, frame, row, column, tag, text, sele=True): entry = tk.Entry(frame, width=35, textvariable=text) entry.grid(row=row, column=column) if sele: button = tk.Button(frame, text='选择') button.grid(row=row, column=column + 1) button['command'] = (lambda: self.__click_select(entry, tag))