Python tkinter.Frame() Examples
The following are 30
code examples of tkinter.Frame().
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: annotation_gui.py From SEM with MIT License | 9 votes |
def preferences(self, event=None): preferenceTop = tkinter.Toplevel() preferenceTop.focus_set() notebook = ttk.Notebook(preferenceTop) frame1 = ttk.Frame(notebook) notebook.add(frame1, text='general') frame2 = ttk.Frame(notebook) notebook.add(frame2, text='shortcuts') c = ttk.Checkbutton(frame1, text="Match whole word when broadcasting annotation", variable=self._whole_word) c.pack() shortcuts_vars = [] shortcuts_gui = [] cur_row = 0 j = -1 frame_list = [] frame_list.append(ttk.LabelFrame(frame2, text="common shortcuts")) frame_list[-1].pack(fill="both", expand="yes") for i, shortcut in enumerate(self.shortcuts): j += 1 key, cmd, bindings = shortcut name, command = cmd shortcuts_vars.append(tkinter.StringVar(frame_list[-1], value=key)) tkinter.Label(frame_list[-1], text=name).grid(row=cur_row, column=0, sticky=tkinter.W) entry = tkinter.Entry(frame_list[-1], textvariable=shortcuts_vars[j]) entry.grid(row=cur_row, column=1) cur_row += 1 notebook.pack() # # ? menu methods #
Example #2
Source File: friendslist.py From Tkinter-GUI-Programming-by-Example with MIT License | 7 votes |
def show_login_screen(self): self.login_frame = ttk.Frame(self) username_label = ttk.Label(self.login_frame, text="Username") self.username_entry = ttk.Entry(self.login_frame) real_name_label = ttk.Label(self.login_frame, text="Real Name") self.real_name_entry = ttk.Entry(self.login_frame) login_button = ttk.Button(self.login_frame, text="Login", command=self.login) create_account_button = ttk.Button(self.login_frame, text="Create Account", command=self.create_account) username_label.grid(row=0, column=0, sticky='e') self.username_entry.grid(row=0, column=1) real_name_label.grid(row=1, column=0, sticky='e') self.real_name_entry.grid(row=1, column=1) login_button.grid(row=2, column=0, sticky='e') create_account_button.grid(row=2, column=1) for i in range(3): tk.Grid.rowconfigure(self.login_frame, i, weight=1) tk.Grid.columnconfigure(self.login_frame, i, weight=1) self.login_frame.pack(fill=tk.BOTH, expand=1)
Example #3
Source File: chartparser_app.py From razzy-spinner with GNU General Public License v3.0 | 7 votes |
def _sb_canvas(self, root, expand='y', fill='both', side='bottom'): """ Helper for __init__: construct a canvas with a scrollbar. """ cframe =tkinter.Frame(root, relief='sunk', border=2) cframe.pack(fill=fill, expand=expand, side=side) canvas = tkinter.Canvas(cframe, background='#e0e0e0') # Give the canvas a scrollbar. sb = tkinter.Scrollbar(cframe, orient='vertical') sb.pack(side='right', fill='y') canvas.pack(side='left', fill=fill, expand='yes') # Connect the scrollbars to the canvas. sb['command']= canvas.yview canvas['yscrollcommand'] = sb.set return (sb, canvas)
Example #4
Source File: labelSettingsFrame.py From PyEveLiveDPS with GNU General Public License v3.0 | 7 votes |
def __init__(self, parent=None, title="", decimalPlaces=0, inThousands=0, *args, **kwargs): tk.Frame.__init__(self, parent, *args, **kwargs) gridFrame = self._nametowidget(parent.winfo_parent()) self.parent = self._nametowidget(gridFrame.winfo_parent()) self.grid(row="0", column="0", sticky="ew") self.columnconfigure(0,weight=1) self.singleLabel = singleLabel = tk.Label(self, text=title) singleLabel.grid(row="0",column="0", sticky="ew") self.listbox = listbox = tk.Spinbox(self, from_=0, to=9, width=1, borderwidth=1, highlightthickness=0) listbox.delete(0,tk.END) listbox.insert(0,decimalPlaces) listbox.grid(row="0", column="1") checkboxValue = tk.IntVar() checkboxValue.set(inThousands) self.checkbox = checkbox = tk.Checkbutton(self, text="K", variable=checkboxValue, borderwidth=0, highlightthickness=0) checkbox.var = checkboxValue checkbox.grid(row="0", column="2") singleLabel.bind("<Button-1>", lambda e:self.dragStart(e, listbox, checkbox))
Example #5
Source File: window.py From LPHK with GNU General Public License v3.0 | 6 votes |
def __init__(self, master=None): tk.Frame.__init__(self, master) self.master = master self.init_window() self.about_image = ImageTk.PhotoImage(Image.open(PATH + "/resources/LPHK-banner.png")) self.info_image = ImageTk.PhotoImage(Image.open(PATH + "/resources/info.png")) self.warning_image = ImageTk.PhotoImage(Image.open(PATH + "/resources/warning.png")) self.error_image = ImageTk.PhotoImage(Image.open(PATH + "/resources/error.png")) self.alert_image = ImageTk.PhotoImage(Image.open(PATH + "/resources/alert.png")) self.scare_image = ImageTk.PhotoImage(Image.open(PATH + "/resources/scare.png")) self.grid_drawn = False self.grid_rects = [[None for y in range(9)] for x in range(9)] self.button_mode = "edit" self.last_clicked = None self.outline_box = None
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: friendslist.py From Tkinter-GUI-Programming-by-Example with MIT License | 6 votes |
def show_friends(self): self.configure(menu=self.menu) self.login_frame.pack_forget() self.canvas = tk.Canvas(self, bg="white") self.canvas_frame = tk.Frame(self.canvas) self.scrollbar = ttk.Scrollbar(self, orient="vertical", command=self.canvas.yview) self.canvas.configure(yscrollcommand=self.scrollbar.set) self.scrollbar.pack(side=tk.LEFT, fill=tk.Y) self.canvas.pack(side=tk.LEFT, expand=1, fill=tk.BOTH) self.friends_area = self.canvas.create_window((0, 0), window=self.canvas_frame, anchor="nw") self.bind_events() self.load_friends()
Example #10
Source File: friendslist.py From Tkinter-GUI-Programming-by-Example with MIT License | 6 votes |
def load_friends(self): all_users = self.requester.get_all_users() for user in all_users: if user['username'] != self.username: friend_frame = ttk.Frame(self.canvas_frame) profile_photo = tk.PhotoImage(file="images/avatar.png") profile_photo_label = ttk.Label(friend_frame, image=profile_photo) profile_photo_label.image = profile_photo friend_name = ttk.Label(friend_frame, text=user['real_name'], anchor=tk.W) message_this_friend = partial(self.open_chat_window, username=user["username"], real_name=user["real_name"]) message_button = ttk.Button(friend_frame, text="Chat", command=message_this_friend) profile_photo_label.pack(side=tk.LEFT) friend_name.pack(side=tk.LEFT) message_button.pack(side=tk.RIGHT) friend_frame.pack(fill=tk.X, expand=1)
Example #11
Source File: friendslist.py From Tkinter-GUI-Programming-by-Example with MIT License | 6 votes |
def __init__(self, **kwargs): super().__init__(**kwargs) self.title('Tk Chat') self.geometry('700x500') self.menu = tk.Menu(self, bg="lightgrey", fg="black", tearoff=0) self.friends_menu = tk.Menu(self.menu, fg="black", bg="lightgrey", tearoff=0) self.friends_menu.add_command(label="Add Friend", command=self.add_friend) self.menu.add_cascade(label="Friends", menu=self.friends_menu) self.configure(menu=self.menu) self.canvas = tk.Canvas(self, bg="white") self.canvas_frame = tk.Frame(self.canvas) self.scrollbar = ttk.Scrollbar(self, orient="vertical", command=self.canvas.yview) self.canvas.configure(yscrollcommand=self.scrollbar.set) self.scrollbar.pack(side=tk.LEFT, fill=tk.Y) self.canvas.pack(side=tk.LEFT, expand=1, fill=tk.BOTH) self.friends_area = self.canvas.create_window((0, 0), window=self.canvas_frame, anchor="nw") self.bind_events() self.load_friends()
Example #12
Source File: friendslist.py From Tkinter-GUI-Programming-by-Example with MIT License | 6 votes |
def load_friends(self): friend_frame = ttk.Frame(self.canvas_frame) profile_photo = tk.PhotoImage(file="images/avatar.png") profile_photo_label = ttk.Label(friend_frame, image=profile_photo) profile_photo_label.image = profile_photo friend_name = ttk.Label(friend_frame, text="Jaden Corebyn", anchor=tk.W) message_button = ttk.Button(friend_frame, text="Chat", command=self.open_chat_window) profile_photo_label.pack(side=tk.LEFT) friend_name.pack(side=tk.LEFT) message_button.pack(side=tk.RIGHT) friend_frame.pack(fill=tk.X, expand=1)
Example #13
Source File: friendslist.py From Tkinter-GUI-Programming-by-Example with MIT License | 6 votes |
def show_login_screen(self): self.login_frame = ttk.Frame(self) username_label = ttk.Label(self.login_frame, text="Username") self.username_entry = ttk.Entry(self.login_frame) self.username_entry.focus_force() real_name_label = ttk.Label(self.login_frame, text="Real Name") self.real_name_entry = ttk.Entry(self.login_frame) login_button = ttk.Button(self.login_frame, text="Login", command=self.login) create_account_button = ttk.Button(self.login_frame, text="Create Account", command=self.create_account) username_label.grid(row=0, column=0, sticky='e') self.username_entry.grid(row=0, column=1) real_name_label.grid(row=1, column=0, sticky='e') self.real_name_entry.grid(row=1, column=1) login_button.grid(row=2, column=0, sticky='e') create_account_button.grid(row=2, column=1) for i in range(3): tk.Grid.rowconfigure(self.login_frame, i, weight=1) tk.Grid.columnconfigure(self.login_frame, i, weight=1) self.login_frame.pack(fill=tk.BOTH, expand=1) self.login_event = self.bind("<Return>", self.login)
Example #14
Source File: friendslist.py From Tkinter-GUI-Programming-by-Example with MIT License | 6 votes |
def load_friends(self): my_friends = self.requester.get_friends(self.username) for user in my_friends["friends"]: if user['username'] != self.username: friend_frame = ttk.Frame(self.canvas_frame) friend_avatar_path = os.path.join(friend_avatars_dir, f"{user['username']}.png") if user["avatar"]: with open(friend_avatar_path, 'wb') as friend_avatar: img = base64.urlsafe_b64decode(user['avatar']) friend_avatar.write(img) else: friend_avatar_path = default_avatar_path profile_photo = tk.PhotoImage(file=friend_avatar_path) profile_photo_label = ttk.Label(friend_frame, image=profile_photo) profile_photo_label.image = profile_photo friend_name = ttk.Label(friend_frame, text=user['real_name'], anchor=tk.W) message_this_friend = partial(self.open_chat_window, username=user["username"], real_name=user["real_name"], avatar=friend_avatar_path) block_this_friend = partial(self.block_friend, username=user["username"]) message_button = ttk.Button(friend_frame, text="Chat", command=message_this_friend) block_button = ttk.Button(friend_frame, text="Block", command=block_this_friend) profile_photo_label.pack(side=tk.LEFT) friend_name.pack(side=tk.LEFT) message_button.pack(side=tk.RIGHT) block_button.pack(side=tk.RIGHT, padx=(0, 30)) friend_frame.pack(fill=tk.X, expand=1)
Example #15
Source File: ui_launch.py From Andromeda with MIT License | 6 votes |
def __init__(self, width=500, height=300): TkBase.__init__(self, width, height) self.plist_path = tk.StringVar() self.plist_path.set(os.path.abspath('.')) frame0 = tk.Frame(self.window) frame0.pack() frame1 = tk.Frame(self.window) frame1.pack() frame2 = tk.Frame(self.window) frame2.pack() self.__make_title_info(frame0, 0, 0) self.__make_title(frame1, 0, 1, 'Andromeda.plist 文件目录') self.__make_title_empty(frame1, 1, 0) self.__make_select_text(frame1, 1, 1, 1, self.plist_path) self.__make_title_empty(frame2, 0, 0) self.__make_select_confirm(frame2, 1, 0) self.window.mainloop()
Example #16
Source File: nemo_app.py From razzy-spinner with GNU General Public License v3.0 | 6 votes |
def __init__(self, image, initialField, initialText): frm = tk.Frame(root) frm.config(background="white") self.image = tk.PhotoImage(format='gif',data=images[image.upper()]) self.imageDimmed = tk.PhotoImage(format='gif',data=images[image]) self.img = tk.Label(frm) self.img.config(borderwidth=0) self.img.pack(side = "left") self.fld = tk.Text(frm, **fieldParams) self.initScrollText(frm,self.fld,initialField) frm = tk.Frame(root) self.txt = tk.Text(frm, **textParams) self.initScrollText(frm,self.txt,initialText) for i in range(2): self.txt.tag_config(colors[i], background = colors[i]) self.txt.tag_config("emph"+colors[i], foreground = emphColors[i])
Example #17
Source File: case.py From mentalist with MIT License | 6 votes |
def open_case_popup(self, case): '''Open popup for defining the Nth character to toggle ''' self.case_popup = Tk.Toplevel() self.case_popup.withdraw() self.case_popup.title('{}: Nth Character'.format(case)) self.case_popup.resizable(width=False, height=False) frame = Tk.Frame(self.case_popup) lb = Tk.Label(frame, text='Select Number of Nth Character'.format(self.title)) lb.pack(fill='both', side='top') sp_box = Tk.Frame(frame) lb1 = Tk.Label(sp_box, text='Number: ') lb1.pack(side='left', padx=5) self.sp_case = Tk.Spinbox(sp_box, width=12, from_=1, to=10000) self.sp_case.pack(side='left') sp_box.pack(fill='both', side='top', padx=30, pady=20) # Ok and Cancel buttons btn_box = Tk.Frame(frame) btn_cancel = Tk.Button(btn_box, text='Cancel', command=self.cancel_case_popup) btn_cancel.pack(side='right', padx=10, pady=20) btn_ok = Tk.Button(btn_box, text='Ok', command=partial(self.on_ok_case_popup, case)) btn_ok.pack(side='left', padx=10, pady=20) btn_box.pack() frame.pack(fill='both', padx=10, pady=10) center_window(self.case_popup, self.main.master) self.case_popup.focus_set()
Example #18
Source File: pynpuzzle.py From pynpuzzle with MIT License | 6 votes |
def create_puzzle_frame(parent_frame, n, current_puzzle_frame=None, read_only=False): """ Creates a new puzzle frame inside a parent frame and if the puzzle frame already exists, first destroys it. This is done because when the n changes we have to change the puzzle frame's grid row and column configurations and it turned out in tkinter it can be done by recreating the frame widget! Returns the newly created puzzle frame. """ if current_puzzle_frame: current_puzzle_frame.destroy() puzzle_frame = tkinter.Frame(parent_frame) puzzle_frame.grid(row=0, column=0, sticky='WENS') draw_puzzle(puzzle_frame, n, read_only) return puzzle_frame
Example #19
Source File: graph.py From PyEveLiveDPS with GNU General Public License v3.0 | 6 votes |
def __init__(self, parent, **kwargs): tk.Frame.__init__(self, parent, **kwargs) self.parent = parent self.degree = 5 self.graphFigure = Figure(figsize=(4,2), dpi=100, facecolor="black") self.subplot = self.graphFigure.add_subplot(1,1,1, facecolor=(0.3, 0.3, 0.3)) self.subplot.tick_params(axis="y", colors="grey", direction="in") self.subplot.tick_params(axis="x", colors="grey", labelbottom="off", bottom="off") self.graphFigure.axes[0].get_xaxis().set_ticklabels([]) self.graphFigure.subplots_adjust(left=(30/100), bottom=(15/100), right=1, top=(1-15/100), wspace=0, hspace=0) self.canvas = FigureCanvasTkAgg(self.graphFigure, self) self.canvas.get_tk_widget().configure(bg="black") self.canvas.get_tk_widget().pack(side=tk.BOTTOM, fill=tk.BOTH, expand=True) self.canvas.show()
Example #20
Source File: baseWindow.py From PyEveLiveDPS with GNU General Public License v3.0 | 6 votes |
def addDraggableEdges(self): self.childWindow.topResizeFrame = tk.Frame(self.childWindow, height=5, background="black", cursor="sb_v_double_arrow") self.childWindow.topResizeFrame.grid(row="0", column="1", columnspan="50", sticky="ew") self.childWindow.topResizeFrame.bind("<ButtonPress-1>", self.StartMove) self.childWindow.topResizeFrame.bind("<ButtonRelease-1>", self.StopMove) self.childWindow.topResizeFrame.bind("<B1-Motion>", self.OnMotionResizeYTop) self.childWindow.bottomResizeFrame = tk.Frame(self.childWindow, height=5, background="black", cursor="sb_v_double_arrow") self.childWindow.bottomResizeFrame.grid(row="20", column="1", columnspan="50", sticky="ew") self.childWindow.bottomResizeFrame.bind("<ButtonPress-1>", self.StartMove) self.childWindow.bottomResizeFrame.bind("<ButtonRelease-1>", self.StopMove) self.childWindow.bottomResizeFrame.bind("<B1-Motion>", self.OnMotionResizeYBottom) self.childWindow.leftResizeFrame = tk.Frame(self.childWindow, width=5, background="black", cursor="sb_h_double_arrow") self.childWindow.leftResizeFrame.grid(row="1", column="0", rowspan="50", sticky="ns") self.childWindow.leftResizeFrame.bind("<ButtonPress-1>", self.StartMove) self.childWindow.leftResizeFrame.bind("<ButtonRelease-1>", self.StopMove) self.childWindow.leftResizeFrame.bind("<B1-Motion>", self.OnMotionResizeXLeft) self.childWindow.rightResizeFrame = tk.Frame(self.childWindow, width=5, background="black", cursor="sb_h_double_arrow") self.childWindow.rightResizeFrame.grid(row="1", column="20", rowspan="50", sticky="ns") self.childWindow.rightResizeFrame.bind("<ButtonPress-1>", self.StartMove) self.childWindow.rightResizeFrame.bind("<ButtonRelease-1>", self.StopMove) self.childWindow.rightResizeFrame.bind("<B1-Motion>", self.OnMotionResizeXRight)
Example #21
Source File: detailSettingsFrame.py From PyEveLiveDPS with GNU General Public License v3.0 | 6 votes |
def __init__(self, parent, mainWindow, **kwargs): tk.Frame.__init__(self, parent, **kwargs) self.parent = parent self.mainWindow = mainWindow self.columnconfigure(1, weight=1) tk.Frame(self, height="20", width="10").grid(row="0", column="1", columnspan="2") checkboxValue = tk.BooleanVar() checkboxValue.set(settings.detailsWindowShow) self.windowDisabled = tk.Checkbutton(self, text="Show Pilot Breakdown window", variable=checkboxValue) self.windowDisabled.var = checkboxValue self.windowDisabled.grid(row="1", column="1", columnspan="2") tk.Frame(self, height="20", width="10").grid(row="2", column="1", columnspan="2") self.makeListBox()
Example #22
Source File: labelSettingsFrame.py From PyEveLiveDPS with GNU General Public License v3.0 | 6 votes |
def makeGrids(self): self.gridFrameLeft = tk.Frame(self) self.gridListLeft = [[self.makeGridBlock(self.gridFrameLeft, row, i) for row in range(8)] for i in range(self.gridColumns[0])] self.gridFrameLeft.grid(row="5", column="1", padx="10") self.gridFrameRight = tk.Frame(self) self.gridListRight = [[self.makeGridBlock(self.gridFrameRight, row, i) for row in range(8)] for i in range(self.gridColumns[1])] self.gridFrameRight.grid(row="5", column="3", padx="10") for item, entries in self.labels.items(): row = entries["row"] column = entries["column"] title = self.text[item] try: GridEntry(self.gridListLeft[column][row], title, entries["decimalPlaces"], entries["inThousands"]) except IndexError: column = column - len(self.gridListLeft) GridEntry(self.gridListRight[column][row], title, entries["decimalPlaces"], entries["inThousands"])
Example #23
Source File: mainWindow.py From PyEveLiveDPS with GNU General Public License v3.0 | 6 votes |
def addQuitButton(self): """ draws and places the quit icon on the main window """ self.quitButton = tk.Canvas(width=15, height=15, background="black", highlightbackground="white", highlightthickness="1") self.quitButton.create_line(0,0,16,16,fill="white") self.quitButton.create_line(1,15,16,0,fill="white") self.quitButton.grid(row="5", column="19", sticky="ne") self.quitButton.bind("<ButtonPress-1>", self.buttonDimGray) self.quitButton.bind("<ButtonRelease-1>", self.quitEvent) self.quitButton.bind("<Enter>", self.buttonGray25) self.quitButton.bind("<Leave>", self.buttonBlack) tk.Frame(self, height=1, width=5, background="black").grid(row="5", column="18") self.rightSpacerFrame = tk.Frame(width=5, height=5, background="black") self.rightSpacerFrame.grid(row="0", column="100", rowspan="50") self.rightSpacerFrame.grid_remove()
Example #24
Source File: Dock.py From python-in-practice with GNU General Public License v3.0 | 6 votes |
def __create_widgets(self): self.dockFrame = ttk.Frame(self, relief=tk.RAISED, padding=PAD) self.dockLeftButton = ttk.Button(self.dockFrame, image=self.images[DOCKLEFT], style="Toolbutton", command=self.dock_left) TkUtil.Tooltip.Tooltip(self.dockLeftButton, text="Dock Left") self.dockRightButton = ttk.Button(self.dockFrame, image=self.images[DOCKRIGHT], style="Toolbutton", command=self.dock_right) TkUtil.Tooltip.Tooltip(self.dockRightButton, text="Dock Right") self.dockLabel = ttk.Label(self.dockFrame, text=self.title, anchor=tk.CENTER) TkUtil.Tooltip.Tooltip(self.dockLabel, text="Drag and drop to " "dock elsewhere or to undock") self.undockButton = ttk.Button(self.dockFrame, image=self.images[UNDOCK], style="Toolbutton", command=self.undock) TkUtil.Tooltip.Tooltip(self.undockButton, text="Undock") self.hideButton = ttk.Button(self.dockFrame, image=self.images[HIDE], style="Toolbutton", command=lambda *args: self.visible.set(False)) TkUtil.Tooltip.Tooltip(self.hideButton, text="Hide") self.create_widgets()
Example #25
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 #26
Source File: cameraConfig.py From crappy with GNU General Public License v2.0 | 6 votes |
def create_infos(self): self.info_frame = tk.Frame() self.info_frame.grid(row=0,column=1) self.fps_label = tk.Label(self.info_frame,text="fps:") self.fps_label.pack() self.auto_range = tk.IntVar() self.range_check = tk.Checkbutton(self.info_frame, text="Auto range",variable=self.auto_range) self.range_check.pack() self.auto_apply = tk.IntVar() self.auto_apply_check = tk.Checkbutton(self.info_frame, text="Auto apply",variable=self.auto_apply) self.auto_apply_check.pack() self.minmax_label = tk.Label(self.info_frame,text="min: max:") self.minmax_label.pack() self.range_label = tk.Label(self.info_frame,text="range:") self.range_label.pack() self.bits_label = tk.Label(self.info_frame,text="detected bits:") self.bits_label.pack() self.zoom_label = tk.Label(self.info_frame,text="Zoom: 100%") self.zoom_label.pack() self.reticle_label = tk.Label(self.info_frame,text="Y:0 X:0 V=0") self.reticle_label.pack()
Example #27
Source File: arduino_basics.py From crappy with GNU General Public License v2.0 | 6 votes |
def create_widgets(self, **kwargs): """ Widgets shown: - The frame's title, - The checkbutton to enable/disable displaying, - The textbox. """ self.top_frame = tk.Frame(self) tk.Label(self.top_frame, text=kwargs.get('title', '')).grid(row=0, column=0) tk.Checkbutton(self.top_frame, variable=self.enabled_checkbox, text="Display?").grid(row=0, column=1) self.serial_monitor = tk.Text(self, relief="sunken", height=int(self.total_width / 10), width=int(self.total_width), font=tkFont.Font(size=kwargs.get("fontsize", 13))) self.top_frame.grid(row=0) self.serial_monitor.grid(row=1)
Example #28
Source File: toolkit.py From PickTrue with MIT License | 5 votes |
def __init__(self, master): tk.Frame.__init__(self, master) self.variable=tk.StringVar() self.label=tk.Label( self, bd=1, relief=tk.SUNKEN, anchor=tk.W, textvariable=self.variable, font=('arial', 16, 'normal') ) self.variable.set('') self.label.pack(fill=tk.X) self.pack(fill=tk.BOTH)
Example #29
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 #30
Source File: findwindow.py From Tkinter-GUI-Programming-by-Example with MIT License | 5 votes |
def __init__(self, master, **kwargs): super().__init__(**kwargs ) self.geometry('350x100') self.title('Find and Replace') self.text_to_find = tk.StringVar() self.text_to_replace_with = tk.StringVar() top_frame = tk.Frame(self) middle_frame = tk.Frame(self) bottom_frame = tk.Frame(self) find_entry_label = tk.Label(top_frame, text="Find: ") self.find_entry = ttk.Entry(top_frame, textvar=self.text_to_find) replace_entry_label = tk.Label(middle_frame, text="Replace: ") self.replace_entry = ttk.Entry(middle_frame, textvar=self.text_to_replace_with) self.find_button = ttk.Button(bottom_frame, text="Find", command=self.on_find) self.replace = ttk.Button(bottom_frame, text="Replace", command=self.on_replace) self.cancel_button = ttk.Button(bottom_frame, text="Cancel", command=self.destroy) find_entry_label.pack(side=tk.LEFT, padx=(20, 0)) self.find_entry.pack(side=tk.LEFT, fill=tk.X, expand=1) replace_entry_label.pack(side=tk.LEFT) self.replace_entry.pack(side=tk.LEFT, fill=tk.X, expand=1) self.find_button.pack(side=tk.LEFT, padx=(85, 0)) self.cancel_button.pack(side=tk.RIGHT, padx=(0, 30)) top_frame.pack(side=tk.TOP, expand=1, fill=tk.X, padx=30) middle_frame.pack(side=tk.TOP, expand=1, fill=tk.X, padx=30) bottom_frame.pack(side=tk.TOP, expand=1, fill=tk.X)