Python tkinter.RIGHT Examples
The following are 30
code examples of tkinter.RIGHT().
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: view.py From Tkinter-GUI-Application-Development-Blueprints-Second-Edition with MIT License | 8 votes |
def create_list_box(self): frame = tk.Frame(self.root) self.list_box = tk.Listbox(frame, activestyle='none', cursor='hand2', bg='#1C3D7D', fg='#A0B9E9', selectmode=tk.EXTENDED, height=10) self.list_box.pack(side=tk.LEFT, fill=tk.BOTH, expand=1) self.list_box.bind( "<Double-Button-1>", self.on_play_list_double_clicked) self.list_box.bind("<Button-3>", self.show_context_menu) scroll_bar = tk.Scrollbar(frame) scroll_bar.pack(side=tk.RIGHT, fill=tk.BOTH) self.list_box.config(yscrollcommand=scroll_bar.set) scroll_bar.config(command=self.list_box.yview) frame.grid(row=4, padx=5, columnspan=10, sticky='ew')
Example #2
Source File: texteditor.py From Tkinter-GUI-Programming-by-Example with MIT License | 6 votes |
def __init__(self): super().__init__() self.text_area = TextArea(self, bg="white", fg="black", undo=True) self.scrollbar = ttk.Scrollbar(orient="vertical", command=self.scroll_text) self.text_area.configure(yscrollcommand=self.scrollbar.set) self.line_numbers = LineNumbers(self, self.text_area, bg="grey", fg="white", width=1) self.highlighter = Highlighter(self.text_area, 'languages/python.yaml') self.scrollbar.pack(side=tk.RIGHT, fill=tk.Y) self.line_numbers.pack(side=tk.LEFT, fill=tk.Y) self.text_area.pack(side=tk.LEFT, fill=tk.BOTH, expand=1) self.bind_events()
Example #3
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 #4
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 #5
Source File: texteditor.py From Tkinter-GUI-Programming-by-Example with MIT License | 6 votes |
def __init__(self): super().__init__() self.text_area = TextArea(self, bg="white", fg="black", undo=True) self.scrollbar = ttk.Scrollbar(orient="vertical", command=self.scroll_text) self.text_area.configure(yscrollcommand=self.scrollbar.set) self.line_numbers = tk.Text(self, bg="grey", fg="white") first_100_numbers = [str(n+1) for n in range(100)] self.line_numbers.insert(1.0, "\n".join(first_100_numbers)) self.line_numbers.configure(state="disabled", width=3) self.scrollbar.pack(side=tk.RIGHT, fill=tk.Y) self.line_numbers.pack(side=tk.LEFT, fill=tk.Y) self.text_area.pack(side=tk.LEFT, fill=tk.BOTH, expand=1) self.bind_events()
Example #6
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 #7
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 #8
Source File: SikuliGui.py From lackey with MIT License | 6 votes |
def __init__(self, master, textvariable=None, *args, **kwargs): tk.Frame.__init__(self, master) # Init GUI self._y_scrollbar = tk.Scrollbar(self, orient=tk.VERTICAL) self._text_widget = tk.Text(self, yscrollcommand=self._y_scrollbar.set, *args, **kwargs) self._text_widget.pack(side=tk.LEFT, fill=tk.BOTH, expand=1) self._y_scrollbar.config(command=self._text_widget.yview) self._y_scrollbar.pack(side=tk.RIGHT, fill=tk.Y) if textvariable is not None: if not isinstance(textvariable, tk.Variable): raise TypeError("tkinter.Variable type expected, {} given.".format( type(textvariable))) self._text_variable = textvariable self.var_modified() self._text_trace = self._text_widget.bind('<<Modified>>', self.text_modified) self._var_trace = textvariable.trace("w", self.var_modified)
Example #9
Source File: _backend_tk.py From Mastering-Elasticsearch-7.0 with MIT License | 6 votes |
def _init_toolbar(self): xmin, xmax = self.canvas.figure.bbox.intervalx height, width = 50, xmax-xmin tk.Frame.__init__(self, master=self.window, width=int(width), height=int(height), borderwidth=2) self.update() # Make axes menu for text, tooltip_text, image_file, callback in self.toolitems: if text is None: # Add a spacer; return value is unused. self._Spacer() else: button = self._Button(text=text, file=image_file, command=getattr(self, callback)) if tooltip_text is not None: ToolTip.createToolTip(button, tooltip_text) self.message = tk.StringVar(master=self) self._message_label = tk.Label(master=self, textvariable=self.message) self._message_label.pack(side=tk.RIGHT) self.pack(side=tk.BOTTOM, fill=tk.X)
Example #10
Source File: _backend_tk.py From GraphicDesignPatternByPython with MIT License | 6 votes |
def _init_toolbar(self): xmin, xmax = self.canvas.figure.bbox.intervalx height, width = 50, xmax-xmin Tk.Frame.__init__(self, master=self.window, width=int(width), height=int(height), borderwidth=2) self.update() # Make axes menu for text, tooltip_text, image_file, callback in self.toolitems: if text is None: # Add a spacer; return value is unused. self._Spacer() else: button = self._Button(text=text, file=image_file, command=getattr(self, callback)) if tooltip_text is not None: ToolTip.createToolTip(button, tooltip_text) self.message = Tk.StringVar(master=self) self._message_label = Tk.Label(master=self, textvariable=self.message) self._message_label.pack(side=Tk.RIGHT) self.pack(side=Tk.BOTTOM, fill=Tk.X)
Example #11
Source File: _backend_tk.py From python3_ios with BSD 3-Clause "New" or "Revised" License | 6 votes |
def _init_toolbar(self): xmin, xmax = self.canvas.figure.bbox.intervalx height, width = 50, xmax-xmin Tk.Frame.__init__(self, master=self.window, width=int(width), height=int(height), borderwidth=2) self.update() # Make axes menu for text, tooltip_text, image_file, callback in self.toolitems: if text is None: # Add a spacer; return value is unused. self._Spacer() else: button = self._Button(text=text, file=image_file, command=getattr(self, callback)) if tooltip_text is not None: ToolTip.createToolTip(button, tooltip_text) self.message = Tk.StringVar(master=self) self._message_label = Tk.Label(master=self, textvariable=self.message) self._message_label.pack(side=Tk.RIGHT) self.pack(side=Tk.BOTTOM, fill=Tk.X)
Example #12
Source File: tkwidgets.py From hwk-mirror with GNU General Public License v3.0 | 6 votes |
def __init__(self, parent, **kwargs): super().__init__(parent, highlightthickness=0, **kwargs) vscrollbar = tk.Scrollbar(self, orient=tk.VERTICAL) vscrollbar.pack(side=tk.RIGHT, fill=tk.Y) self.canvas = canvas = tk.Canvas(self, bd=2, highlightthickness=0, yscrollcommand=vscrollbar.set) canvas.pack(side=tk.TOP, fill=tk.BOTH, expand=True) vscrollbar.config(command=canvas.yview) canvas.xview_moveto(0) canvas.yview_moveto(0) self.interior = interior = tk.Frame(canvas) self.interior_id = canvas.create_window(0, 0, window=interior, anchor=tk.NW) self.interior.bind("<Configure>", self.configure_interior) self.canvas.bind("<Configure>", self.configure_canvas) self.scrollbar = vscrollbar self.mouse_position = 0
Example #13
Source File: update_gui.py From Trade-Dangerous with Mozilla Public License 2.0 | 6 votes |
def addInput(self, item, defValue, row): pos = len(row) inputVal = tk.StringVar() inputVal.set(str(defValue)) inputEl = tk.Entry(self.interior, width=10, justify=tk.RIGHT, textvariable=inputVal) inputEl.item = item inputEl.row = row inputEl.pos = pos inputEl.val = inputVal inputEl.bind('<Shift-Key-Tab>', self.onShiftTab) inputEl.bind('<Key-Tab>', self.onTab) inputEl.bind('<Key-Return>', self.onReturn) inputEl.bind('<Key-Down>', self.onDown) inputEl.bind('<Key-Up>', self.onUp) inputEl.bind('<FocusOut>', lambda evt: self.validateRow(evt.widget.row)) self.addWidget(inputEl, sticky='E') row.append((inputEl, inputVal))
Example #14
Source File: view.py From Tkinter-GUI-Application-Development-Blueprints-Second-Edition with MIT License | 6 votes |
def create_list_box(self): frame = tk.Frame(self.root) self.list_box = tk.Listbox(frame, activestyle='none', cursor='hand2', bg='#1C3D7D', fg='#A0B9E9', selectmode=tk.EXTENDED, height=10) self.list_box.pack(side=tk.LEFT, fill=tk.BOTH, expand=1) self.list_box.bind( "<Double-Button-1>", self.on_play_list_double_clicked) self.list_box.bind("<Button-3>", self.show_context_menu) scroll_bar = tk.Scrollbar(frame) scroll_bar.pack(side=tk.RIGHT, fill=tk.BOTH) self.list_box.config(yscrollcommand=scroll_bar.set) scroll_bar.config(command=self.list_box.yview) frame.grid(row=4, padx=5, columnspan=10, sticky='ew')
Example #15
Source File: 6.09.py From Tkinter-GUI-Application-Development-Blueprints-Second-Edition with MIT License | 5 votes |
def create_drawing_canvas(self): self.canvas_frame = tk.Frame(self.root, width=900, height=900) self.canvas_frame.pack(side="right", expand="yes", fill="both") self.canvas = tk.Canvas(self.canvas_frame, background="white", width=500, height=500, scrollregion=(0, 0, 800, 800)) self.create_scroll_bar() self.canvas.pack(side=tk.RIGHT, expand=tk.YES, fill=tk.BOTH)
Example #16
Source File: 6.04.py From Tkinter-GUI-Application-Development-Blueprints-Second-Edition with MIT License | 5 votes |
def create_drawing_canvas(self): self.canvas_frame = tk.Frame(self.root, width=900, height=900) self.canvas_frame.pack(side="right", expand="yes", fill="both") self.canvas = tk.Canvas(self.canvas_frame, background="white", width=500, height=500, scrollregion=(0, 0, 800, 800)) self.create_scroll_bar() self.canvas.pack(side=tk.RIGHT, expand=tk.YES, fill=tk.BOTH)
Example #17
Source File: 6.05.py From Tkinter-GUI-Application-Development-Blueprints-Second-Edition with MIT License | 5 votes |
def create_drawing_canvas(self): self.canvas_frame = tk.Frame(self.root, width=900, height=900) self.canvas_frame.pack(side="right", expand="yes", fill="both") self.canvas = tk.Canvas(self.canvas_frame, background="white", width=500, height=500, scrollregion=(0, 0, 800, 800)) self.create_scroll_bar() self.canvas.pack(side=tk.RIGHT, expand=tk.YES, fill=tk.BOTH)
Example #18
Source File: view.py From Tkinter-GUI-Application-Development-Blueprints-Second-Edition with MIT License | 5 votes |
def create_list_box(self): frame = tk.Frame(self.root) self.list_box = tk.Listbox(frame, activestyle='none', cursor='hand2', bg='#1C3D7D', fg='#A0B9E9', selectmode=tk.EXTENDED, height=10) self.list_box.pack(side=tk.LEFT, fill=tk.BOTH, expand=1) self.list_box.bind( "<Double-Button-1>", self.on_play_list_double_clicked) self.list_box.bind("<Button-3>", self.show_context_menu) scroll_bar = tk.Scrollbar(frame) scroll_bar.pack(side=tk.RIGHT, fill=tk.BOTH) self.list_box.config(yscrollcommand=scroll_bar.set) scroll_bar.config(command=self.list_box.yview) frame.grid(row=4, padx=5, columnspan=10, sticky='ew')
Example #19
Source File: scrolledframe.py From ttkwidgets with GNU General Public License v3.0 | 5 votes |
def __init__(self, master=None, compound=tk.RIGHT, canvasheight=400, canvaswidth=400, canvasborder=0, autohidescrollbar=True, **kwargs): """ Create a ScrolledFrame. :param master: master widget :type master: widget :param compound: "right" or "left": side the scrollbar should be on :type compound: str :param canvasheight: height of the internal canvas :type canvasheight: int :param canvaswidth: width of the internal canvas :type canvaswidth: int :param canvasborder: border width of the internal canvas :type canvasborder: int :param autohidescrollbar: whether to use an :class:`~ttkwidgets.AutoHideScrollbar` or a :class:`ttk.Scrollbar` :type autohidescrollbar: bool :param kwargs: keyword arguments passed on to the :class:`ttk.Frame` initializer """ ttk.Frame.__init__(self, master, **kwargs) self.rowconfigure(0, weight=1) self.columnconfigure(1, weight=1) if autohidescrollbar: self._scrollbar = AutoHideScrollbar(self, orient=tk.VERTICAL) else: self._scrollbar = ttk.Scrollbar(self, orient=tk.VERTICAL) self._canvas = tk.Canvas(self, borderwidth=canvasborder, highlightthickness=0, yscrollcommand=self._scrollbar.set, width=canvaswidth, height=canvasheight) self.__compound = compound self._scrollbar.config(command=self._canvas.yview) self._canvas.yview_moveto(0) self.interior = ttk.Frame(self._canvas) self._interior_id = self._canvas.create_window(0, 0, window=self.interior, anchor=tk.NW) self.interior.bind("<Configure>", self.__configure_interior) self._canvas.bind("<Configure>", self.__configure_canvas) self.__grid_widgets()
Example #20
Source File: scrolledlistbox.py From ttkwidgets with GNU General Public License v3.0 | 5 votes |
def __init__(self, master=None, compound=tk.RIGHT, autohidescrollbar=True, **kwargs): """ Create a Listbox with a vertical scrollbar. :param master: master widget :type master: widget :param compound: side for the Scrollbar to be on (:obj:`tk.LEFT` or :obj:`tk.RIGHT`) :type compound: str :param autohidescrollbar: whether to use an :class:`~ttkwidgets.AutoHideScrollbar` or a :class:`ttk.Scrollbar` :type autohidescrollbar: bool :param kwargs: keyword arguments passed on to the :class:`tk.Listbox` initializer """ ttk.Frame.__init__(self, master) self.columnconfigure(1, weight=1) self.rowconfigure(0, weight=1) self.listbox = tk.Listbox(self, **kwargs) if autohidescrollbar: self.scrollbar = AutoHideScrollbar(self, orient=tk.VERTICAL, command=self.listbox.yview) else: self.scrollbar = ttk.Scrollbar(self, orient=tk.VERTICAL, command=self.listbox.yview) self.config_listbox(yscrollcommand=self.scrollbar.set) if compound is not tk.LEFT and compound is not tk.RIGHT: raise ValueError("Invalid compound value passed: {0}".format(compound)) self.__compound = compound self._grid_widgets()
Example #21
Source File: 6.02.py From Tkinter-GUI-Application-Development-Blueprints-Second-Edition with MIT License | 5 votes |
def create_drawing_canvas(self): self.canvas_frame = tk.Frame(self.root, width=900, height=900) self.canvas_frame.pack(side="right", expand="yes", fill="both") self.canvas = tk.Canvas(self.canvas_frame, background="white", width=500, height=500, scrollregion=(0, 0, 800, 800)) self.create_scroll_bar() self.canvas.pack(side=tk.RIGHT, expand=tk.YES, fill=tk.BOTH)
Example #22
Source File: scaleentry.py From ttkwidgets with GNU General Public License v3.0 | 5 votes |
def _grid_widgets(self): """Put the widgets in the correct position based on self.__compound.""" orient = str(self._scale.cget('orient')) self._scale.grid(row=2, column=2, sticky='ew' if orient == tk.HORIZONTAL else 'ns', padx=(0, self.__entryscalepad) if self.__compound is tk.RIGHT else (self.__entryscalepad, 0) if self.__compound is tk.LEFT else 0, pady=(0, self.__entryscalepad) if self.__compound is tk.BOTTOM else (self.__entryscalepad, 0) if self.__compound is tk.TOP else 0) self._entry.grid(row=1 if self.__compound is tk.TOP else 3 if self.__compound is tk.BOTTOM else 2, column=1 if self.__compound is tk.LEFT else 3 if self.__compound is tk.RIGHT else 2) if orient == tk.HORIZONTAL: self.columnconfigure(0, weight=0) self.columnconfigure(2, weight=1) self.columnconfigure(4, weight=0) self.rowconfigure(0, weight=1) self.rowconfigure(2, weight=0) self.rowconfigure(4, weight=1) else: self.rowconfigure(0, weight=0) self.rowconfigure(2, weight=1) self.rowconfigure(4, weight=0) self.columnconfigure(0, weight=1) self.columnconfigure(2, weight=0) self.columnconfigure(4, weight=1)
Example #23
Source File: scaleentry.py From ttkwidgets with GNU General Public License v3.0 | 5 votes |
def __init__(self, master=None, scalewidth=50, entrywidth=5, from_=0, to=50, orient=tk.HORIZONTAL, compound=tk.RIGHT, entryscalepad=0, **kwargs): """ Create a ScaleEntry. :param master: master widget :type master: widget :param scalewidth: width of the Scale in pixels :type scalewidth: int :param entrywidth: width of the Entry in characters :type entrywidth: int :param from\_: start value of the scale :type from\_: int :param to: end value of the scale :type to: int :param orient: scale orientation. Supports :obj:`tk.HORIZONTAL` and :obj:`tk.VERTICAL` :type orient: str :param compound: side the Entry must be on. Supports :obj:`tk.LEFT`, :obj:`tk.RIGHT`, :obj:`tk.TOP` and :obj:`tk.BOTTOM` :type compound: str :param entryscalepad: space between the entry and the scale :type entryscalepad: int :param kwargs: keyword arguments passed on to the :class:`ttk.Frame` initializer """ ttk.Frame.__init__(self, master, **kwargs) if compound is not tk.RIGHT and compound is not tk.LEFT and compound is not tk.TOP and \ compound is not tk.BOTTOM: raise ValueError("Invalid value for compound passed {0}".format(compound)) self.__compound = compound if not isinstance(entryscalepad, int): raise TypeError("entryscalepad not of int type") self.__entryscalepad = entryscalepad self._variable = self.LimitedIntVar(from_, to) self._scale = ttk.Scale(self, from_=from_, to=to, length=scalewidth, orient=orient, command=self._on_scale, variable=self._variable) # Note that the textvariable keyword argument is not used to pass the LimitedIntVar self._entry = ttk.Entry(self, width=entrywidth) self._entry.insert(0, str(from_)) self._entry.bind("<KeyRelease>", self._on_entry) self._grid_widgets()
Example #24
Source File: test_scrolledlistbox.py From ttkwidgets with GNU General Public License v3.0 | 5 votes |
def test_scrolledlistbox_init(self): listbox = ScrolledListbox(self.window, height=10, width=10, compound=tk.LEFT) listbox.pack() self.window.update() self.assertFalse(listbox.scrollbar.winfo_ismapped()) listbox.destroy() listbox = ScrolledListbox(self.window, height=20, width=10, compound=tk.RIGHT, autohidescrollbar=False) listbox.pack() self.window.update() self.assertTrue(listbox.scrollbar.winfo_ismapped())
Example #25
Source File: 6.01.py From Tkinter-GUI-Application-Development-Blueprints-Second-Edition with MIT License | 5 votes |
def create_drawing_canvas(self): self.canvas_frame = tk.Frame(self.root, width=900, height=900) self.canvas_frame.pack(side="right", expand="yes", fill="both") self.canvas = tk.Canvas(self.canvas_frame, background="white", width=500, height=500, scrollregion=(0, 0, 800, 800)) self.create_scroll_bar() self.canvas.pack(side=tk.RIGHT, expand=tk.YES, fill=tk.BOTH)
Example #26
Source File: _backend_tk.py From Mastering-Elasticsearch-7.0 with MIT License | 5 votes |
def __init__(self, window, *args, **kwargs): StatusbarBase.__init__(self, *args, **kwargs) xmin, xmax = self.toolmanager.canvas.figure.bbox.intervalx height, width = 50, xmax - xmin tk.Frame.__init__(self, master=window, width=int(width), height=int(height), borderwidth=2) self._message = tk.StringVar(master=self) self._message_label = tk.Label(master=self, textvariable=self._message) self._message_label.pack(side=tk.RIGHT) self.pack(side=tk.TOP, fill=tk.X)
Example #27
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)
Example #28
Source File: Main.py From python-in-practice with GNU General Public License v3.0 | 5 votes |
def create_toolbar(self): self.toolbar = ttk.Frame(self.master) newButton = ttk.Button(self.toolbar, text=NEW, takefocus=False, image=self.images[NEW], command=self.board.new_game) TkUtil.Tooltip.Tooltip(newButton, text="New Game") zoomLabel = ttk.Label(self.toolbar, text="Zoom:") self.zoomSpinbox = Spinbox(self.toolbar, textvariable=self.zoom, from_=Board.MIN_ZOOM, to=Board.MAX_ZOOM, increment=Board.ZOOM_INC, width=3, justify=tk.RIGHT, validate="all") self.zoomSpinbox.config(validatecommand=( self.zoomSpinbox.register(self.validate_int), "%P")) TkUtil.Tooltip.Tooltip(self.zoomSpinbox, text="Zoom level (%)") self.shapeCombobox = ttk.Combobox(self.toolbar, width=8, textvariable=self.shapeName, state="readonly", values=sorted(Shapes.ShapeForName.keys())) TkUtil.Tooltip.Tooltip(self.shapeCombobox, text="Tile Shape") TkUtil.add_toolbar_buttons(self.toolbar, (newButton, None, zoomLabel, self.zoomSpinbox, self.shapeCombobox)) self.toolbar.pack(side=tk.TOP, fill=tk.X, before=self.board)
Example #29
Source File: Preferences.py From python-in-practice with GNU General Public License v3.0 | 5 votes |
def create_advanced_widgets(self, master): self.delayLabel = TkUtil.Label(master, text="Delay (ms)", underline=0) self.delaySpinbox = Spinbox(master, textvariable=self.delay, from_=Board.MIN_DELAY, to=Board.MAX_DELAY, increment=25, width=4, justify=tk.RIGHT, validate="all") self.delaySpinbox.config(validatecommand=( self.delaySpinbox.register(self.validate_int), "delaySpinbox", "%P")) self.zoomLabel = TkUtil.Label(master, text="Zoom (%)", underline=0) self.zoomSpinbox = Spinbox(master, textvariable=self.options.zoom, from_=Board.MIN_ZOOM, to=Board.MAX_ZOOM, increment=Board.ZOOM_INC, width=4, justify=tk.RIGHT, validate="all") self.zoomSpinbox.config(validatecommand=( self.zoomSpinbox.register(self.validate_int), "zoomSpinbox", "%P")) self.showToolbarCheckbutton = TkUtil.Checkbutton(master, text="Show Toolbar", underline=5, variable=self.showToolbar) self.restoreCheckbutton = TkUtil.Checkbutton(master, text="Restore Position", underline=0, variable=self.restore)
Example #30
Source File: _backend_tk.py From GraphicDesignPatternByPython with MIT License | 5 votes |
def __init__(self, window, *args, **kwargs): StatusbarBase.__init__(self, *args, **kwargs) xmin, xmax = self.toolmanager.canvas.figure.bbox.intervalx height, width = 50, xmax - xmin Tk.Frame.__init__(self, master=window, width=int(width), height=int(height), borderwidth=2) self._message = Tk.StringVar(master=self) self._message_label = Tk.Label(master=self, textvariable=self._message) self._message_label.pack(side=Tk.RIGHT) self.pack(side=Tk.TOP, fill=Tk.X)