Python tkinter.ALL Examples
The following are 30
code examples of tkinter.ALL().
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: pynpuzzle.py From pynpuzzle with MIT License | 6 votes |
def draw_puzzle(puzzle_frame, n, read_only=False): """ Fills a frame widget with n + 1 entry widget. puzzle_frame : The puzzle frame to get filled by entry widgets. n : Puzzle type (n-puzzle). read_only : Should widgets be read-only or not """ n = int(math.sqrt(n + 1)) for i in range(n): for j in range(n): entry = tkinter.Entry(puzzle_frame, width=4, justify='center') entry.grid(row=i, column=j, sticky='WENS') if read_only: # Bind the widget validation command to return_false_validate command and therefore # OUTPUT_EDITABLE global variable. entry.config(validatecommand=return_false_validate, validate=tkinter.ALL) puzzle_frame.grid_columnconfigure(i, weight=1) puzzle_frame.grid_rowconfigure(i, weight=1)
Example #2
Source File: review_filtered_clips.py From youtube-gesture-dataset with BSD 3-Clause "New" or "Revised" License | 6 votes |
def OnVideoListClick(self, event): """ load clip data """ item = self.vid_tree.identify('item', event.x, event.y) vid = self.vid_tree.item(item, "text") self.vid = vid self.tx_vid_name.configure(text=vid) self.tx_clip_interval.configure(text='No selected clip') self.img_canvas.delete(tk.ALL) self.message.config(text=' ') self.tx_ratio_small.config(text='None') self.tx_ratio_side.config(text='None') self.tx_ratio_missing.config(text='None') self.tx_ratio_back.config(text='None') self.tx_frame_diff.config(text='None') print(vid) self.clip_data = load_clip_data(vid) self.skeleton = SkeletonWrapper(my_config.SKELETON_PATH, vid) self.video_wrapper = read_video(my_config.VIDEO_PATH, vid) self.clip_filter_data = load_clip_filtering_aux_info(vid) self.load_clip() self.win.update()
Example #3
Source File: timeline.py From ttkwidgets with GNU General Public License v3.0 | 6 votes |
def delete_marker(self, iid): """ Delete a marker from the TimeLine :param iid: marker identifier :type iid: str """ if iid == tk.ALL: for iid in self.markers.keys(): self.delete_marker(iid) return options = self._markers[iid] rectangle_id, text_id = options["rectangle_id"], options["text_id"] del self._canvas_markers[rectangle_id] del self._canvas_markers[text_id] del self._markers[iid] self._timeline.delete(rectangle_id, text_id)
Example #4
Source File: viewer.py From gdspy with Boost Software License 1.0 | 6 votes |
def _zoom(self, evt): if evt.num == 4: evt.delta = 1 elif evt.num == 5: evt.delta = -1 s = 1.5 if evt.delta > 0 else 1 / 1.5 self.scale /= s x0 = s * self.canvas.canvasx(evt.x) - evt.x y0 = s * self.canvas.canvasy(evt.y) - evt.y self.canvas.scale(tkinter.ALL, 0, 0, s, s) self.canvas.x_rl *= s self.canvas.y_rl *= s bb = self.canvas.bbox(tkinter.ALL) if bb is not None: w = (bb[2] - bb[0]) * 1.2 h = (bb[3] - bb[1]) * 1.2 bb = (bb[0] - w, bb[1] - h, bb[2] + w, bb[3] + h) self.canvas["scrollregion"] = bb self.canvas.xview(tkinter.MOVETO, (x0 - bb[0]) / (bb[2] - bb[0])) self.canvas.yview(tkinter.MOVETO, (y0 - bb[1]) / (bb[3] - bb[1]))
Example #5
Source File: viewer.py From gdspy with Boost Software License 1.0 | 6 votes |
def _zoom_in(self): s = 1.5 self.scale /= s self.canvas.scale(tkinter.ALL, 0, 0, s, s) self.canvas.x_rl *= s self.canvas.y_rl *= s bb = self.canvas.bbox(tkinter.ALL) w = (bb[2] - bb[0]) * 1.2 h = (bb[3] - bb[1]) * 1.2 bb = (bb[0] - w, bb[1] - h, bb[2] + w, bb[3] + h) self.canvas["scrollregion"] = bb x0 = self.xscroll.get() x0 = 0.5 * (x0[1] + x0[0]) - 0.5 * ( (float(self.canvas.winfo_width()) - self.canvas_margins[0]) / (bb[2] - bb[0]) ) y0 = self.yscroll.get() y0 = 0.5 * (y0[1] + y0[0]) - 0.5 * ( (float(self.canvas.winfo_height()) - self.canvas_margins[1]) / (bb[3] - bb[1]) ) self.canvas.xview(tkinter.MOVETO, x0) self.canvas.yview(tkinter.MOVETO, y0)
Example #6
Source File: viewer.py From gdspy with Boost Software License 1.0 | 6 votes |
def _zoom_out(self): s = 1 / 1.5 self.scale /= s self.canvas.scale(tkinter.ALL, 0, 0, s, s) self.canvas.x_rl *= s self.canvas.y_rl *= s bb = self.canvas.bbox(tkinter.ALL) w = (bb[2] - bb[0]) * 1.2 h = (bb[3] - bb[1]) * 1.2 bb = (bb[0] - w, bb[1] - h, bb[2] + w, bb[3] + h) self.canvas["scrollregion"] = bb x0 = self.xscroll.get() x0 = 0.5 * (x0[1] + x0[0]) - 0.5 * ( (float(self.canvas.winfo_width()) - self.canvas_margins[0]) / (bb[2] - bb[0]) ) y0 = self.yscroll.get() y0 = 0.5 * (y0[1] + y0[0]) - 0.5 * ( (float(self.canvas.winfo_height()) - self.canvas_margins[1]) / (bb[3] - bb[1]) ) self.canvas.xview(tkinter.MOVETO, x0) self.canvas.yview(tkinter.MOVETO, y0)
Example #7
Source File: zynthian_gui_songeditor.py From zynthian-ui with GNU General Public License v3.0 | 6 votes |
def drawGrid(self, clearGrid = False): font = tkFont.Font(family=zynthian_gui_config.font_topbar[0], size=self.fontsize) if clearGrid: self.gridCanvas.delete(tkinter.ALL) self.columnWidth = self.gridWidth / self.horizontalZoom self.trackTitleCanvas.delete("trackname") self.playCanvas.delete("timetext") # Draw cells of grid self.gridCanvas.itemconfig("gridcell", fill=CELL_BACKGROUND) for row in range(self.verticalZoom): if row >= len(self.tracks): break if clearGrid: self.trackTitleCanvas.create_text((0, self.rowHeight * (row + 0.5)), text="Track %d" % (self.tracks[row]), font=font, fill=CELL_FOREGROUND, tags=("rowtitle%d" % (row),"trackname"), anchor="w") self.gridCanvas.create_text(self.gridWidth - self.selectThickness, self.rowHeight * (self.rowHeight * int(row + 0.5)), state="hidden", tags=("lastpatterntext%d" % (row), "lastpatterntext"), font=font, anchor="e") self.drawRow(row) self.playCanvas.create_text(0 * self.columnWidth, PLAYHEAD_HEIGHT / 2, text="%d"%(self.colOffset), tags=("timetext"), anchor="w", fill=CELL_FOREGROUND) if clearGrid: for clock in range(self.horizontalZoom): self.gridCanvas.tag_lower("clock%d"%clock) # Function to update selectedCell # clock: Clock (column) of selected cell (Optional - default to reselect current column) # track: Track number of selected cell (Optional - default to reselect current =row)
Example #8
Source File: recipe-578004.py From code with MIT License | 5 votes |
def clear(self): "Clears canvas of all objects shown on it." self.canvas.delete(tkinter.ALL)
Example #9
Source File: 9.06_weather_ reporter.py From Tkinter-GUI-Application-Development-Blueprints-Second-Edition with MIT License | 5 votes |
def clear_canvas(self): self.canvas.delete(ALL) self.canvas.create_rectangle(10, 10, 330, 415, fill='#F6AF06')
Example #10
Source File: Drawing.py From guizero with BSD 3-Clause "New" or "Revised" License | 5 votes |
def clear(self): """ Clears the drawing. """ self._images.clear() self.tk.delete(ALL)
Example #11
Source File: zynthian_gui_seqtrigger.py From zynthian-ui with GNU General Public License v3.0 | 5 votes |
def drawGrid(self, clear = False): if clear: self.gridCanvas.delete(tkinter.ALL) for col in range(self.columns): self.drawColumn(col, clear) # Function to draw grid column # col: Column index
Example #12
Source File: zynthian_gui_patterneditor.py From zynthian-ui with GNU General Public License v3.0 | 5 votes |
def drawGrid(self, clearGrid = False): font = tkFont.Font(family=zynthian_gui_config.font_topbar[0], size=self.fontsize) if clearGrid: self.gridCanvas.delete(tkinter.ALL) self.stepWidth = (self.gridWidth - 2) / self.parent.libseq.getSteps() self.drawPianoroll() # Draw cells of grid self.gridCanvas.itemconfig("gridcell", fill="black") # Redraw gridlines self.gridCanvas.delete("gridline") if self.parent.libseq.getStepsPerBeat(): for step in range(0, self.parent.libseq.getSteps() + 1, self.parent.libseq.getStepsPerBeat()): self.gridCanvas.create_line(step * self.stepWidth, 0, step * self.stepWidth, self.zoom * self.rowHeight - 1, fill=GRID_LINE, tags=("gridline")) # Delete existing note names self.pianoRoll.delete("notename") for note in range(self.keyOrigin, self.keyOrigin + self.zoom): # Update pianoroll keys key = note % 12 row = note - self.keyOrigin self.drawRow(note) if clearGrid: # Create last note labels in grid self.gridCanvas.create_text(self.gridWidth - self.selectThickness, self.fontsize, state="hidden", tags=("lastnotetext%d" % (row), "lastnotetext"), font=font, anchor="e") id = "row%d" % (row) if key in (0,2,4,5,7,9,11): self.pianoRoll.itemconfig(id, fill="white") if key == 0: self.pianoRoll.create_text((self.pianoRollWidth / 2, self.rowHeight * (self.zoom - row - 0.5)), text="C%d (%d)" % ((self.keyOrigin + row) // 12 - 1, self.keyOrigin + row), font=font, fill=CANVAS_BACKGROUND, tags="notename") self.gridCanvas.create_line(0, (self.zoom - row) * self.rowHeight, self.gridWidth, (self.zoom - row) * self.rowHeight, fill=GRID_LINE, tags=("gridline")) else: self.pianoRoll.itemconfig(id, fill="black") # Set z-order to allow duration to show if clearGrid: for step in range(self.parent.libseq.getSteps()): self.gridCanvas.tag_lower("step%d"%step) self.gridCanvas.tag_raise("selection") # Function to draw pianoroll keys (does not fill key colour)
Example #13
Source File: zynthian_gui_patterneditor.py From zynthian-ui with GNU General Public License v3.0 | 5 votes |
def drawPianoroll(self): self.pianoRoll.delete(tkinter.ALL) for row in range(self.zoom): x1 = 0 y1 = self.getCell(0, row, 1)[1] x2 = self.pianoRollWidth y2 = y1 + self.rowHeight - 1 id = "row%d" % (row) id = self.pianoRoll.create_rectangle(x1, y1, x2, y2, width=0, tags=id) # Function to update selectedCell # step: Step (column) of selected cell (Optional - default to reselect current column) # note: Note number of selected cell (Optional - default to reselect current column)
Example #14
Source File: chapter2_07.py From Tkinter-GUI-Application-Development-Cookbook with MIT License | 5 votes |
def resize(self, event): region = self.canvas.bbox(tk.ALL) self.canvas.configure(scrollregion=region)
Example #15
Source File: chapter7_08.py From Tkinter-GUI-Application-Development-Cookbook with MIT License | 5 votes |
def clear_items(self): self.canvas.delete(tk.ALL)
Example #16
Source File: review_filtered_clips.py From youtube-gesture-dataset with BSD 3-Clause "New" or "Revised" License | 5 votes |
def make_view_combobox(self): self.mode = tk.StringVar() self.view_combo = ttk.Combobox(self.top_frame, values=('ALL', 'TRUE', 'FALSE'), textvariable=self.mode) self.view_combo.grid(row=2, column=0, sticky=(tk.N + tk.S + tk.E + tk.W), padx=5, pady=5) self.view_combo.current(0) self.view_combo.bind('<<ComboboxSelected>>', self.OnComboSelected)
Example #17
Source File: review_filtered_clips.py From youtube-gesture-dataset with BSD 3-Clause "New" or "Revised" License | 5 votes |
def load_clip(self): if self.vid == '-1': print('Error: load video first') return # init clip tree for i in self.clip_tree.get_children(): self.clip_tree.delete(i) self.tx_clip_interval.configure(text='No selected clip') self.img_canvas.delete(tk.ALL) for item in self.item: item.set(False) if self.clip_data and self.skeleton.skeletons != []: # load clips for i, clip in enumerate(self.clip_data): start_frame_no = clip['clip_info'][0] end_frame_no = clip['clip_info'][1] correct_clip = clip['clip_info'][2] if self.MODE == 'ALL': self.clip_tree.insert('', 'end', text=str(start_frame_no) + ' ~ ' + str(end_frame_no), values=i, iid=i, tag=str(correct_clip)) elif self.MODE == 'TRUE': if correct_clip: self.clip_tree.insert('', 'end', text=str(start_frame_no) + ' ~ ' + str(end_frame_no), values=i, iid=i, tag=str(correct_clip)) elif self.MODE == 'FALSE': if not correct_clip: self.clip_tree.insert('', 'end', text=str(start_frame_no) + ' ~ ' + str(end_frame_no), values=i, iid=i, tag=str(correct_clip)) else: print('[Error] Data file does not exist') self.tx_clip_interval.configure(text="Data file does not exist") self.win.update()
Example #18
Source File: gui.py From snake with MIT License | 5 votes |
def _update_contents(self): self._canvas.delete(tk.ALL) self._draw_bg() if self._conf.show_grid_line: self._draw_grid_line() if self._conf.show_info_panel: self._draw_info_panel() self._draw_map_contents() self.update()
Example #19
Source File: table_gui.py From pyDEA with MIT License | 5 votes |
def add_rows_to_fill_visible_frame(self): ''' Adds rows to table to fill the frame. Usually adds a bit more and scroll gets activated. Exact number of added rows depends on operating system, height of widgets and screen size. ''' self.canvas.update_idletasks() frame_height = self.canvas.winfo_height() while self.canvas.bbox(ALL)[3] <= frame_height - 20: self.add_row() self._update_scroll_region()
Example #20
Source File: graph_canvas.py From networkx_viewer with GNU General Public License v3.0 | 5 votes |
def center_on_node(self, data_node): """Center canvas on given **DATA** node""" try: disp_node = self._find_disp_node(data_node) except ValueError as e: tkm.showerror("Unable to find node", str(e)) return x,y = self.coords(self.dispG.node[disp_node]['token_id']) # Find center of canvas w = self.winfo_width()/2 h = self.winfo_height()/2 if w == 0: # We haven't been drawn yet w = int(self['width'])/2 h = int(self['height'])/2 # Calc delta to move to center delta_x = w - x delta_y = h - y self.move(tk.ALL, delta_x, delta_y)
Example #21
Source File: graph_canvas.py From networkx_viewer with GNU General Public License v3.0 | 5 votes |
def clear(self): """Clear the canvas and display graph""" self.delete(tk.ALL) self.dispG.clear()
Example #22
Source File: timeline.py From ttkwidgets with GNU General Public License v3.0 | 5 votes |
def clear_timeline(self): """ Clear the contents of the TimeLine Canvas Does not modify the actual markers dictionary and thus after redrawing all markers are visible again. """ self._timeline.delete(tk.ALL) self._canvas_ticks.delete(tk.ALL)
Example #23
Source File: Main.py From GraphicDesignPatternByPython with MIT License | 5 votes |
def _clearCanvas(self, event): self.history.clear() self.canvas.delete(tkinter.ALL)
Example #24
Source File: Main.py From GraphicDesignPatternByPython with MIT License | 5 votes |
def _undoCanvas(self, event): self.history.undo() self.canvas.delete(tkinter.ALL) self.history.execute()
Example #25
Source File: dea_utils.py From pyDEA with MIT License | 5 votes |
def on_canvas_resize(canvas): ''' This function updates scroll region of the canvas. It should be called on canvas resize. Args: canvas (Canvas): canvas ''' canvas.update_idletasks() yscroll = 0 xscroll = 0 if canvas.bbox(ALL)[2] > canvas.winfo_width(): yscroll = canvas.bbox(ALL)[2] if canvas.bbox(ALL)[3] > canvas.winfo_height(): xscroll = canvas.bbox(ALL)[3] canvas['scrollregion'] = (0, 0, yscroll, xscroll)
Example #26
Source File: categories_checkbox_gui.py From pyDEA with MIT License | 5 votes |
def update_scroll_region(self): ''' Updates scrolling region. ''' self.frame_with_boxes.update() self.canvas['scrollregion'] = self.canvas.bbox(ALL)
Example #27
Source File: graph_canvas.py From networkx_viewer with GNU General Public License v3.0 | 5 votes |
def onPanMotion(self, event): # compute how much to move delta_x = event.x - self._pan_data[0] delta_y = event.y - self._pan_data[1] self.move(tk.ALL, delta_x, delta_y) # Record new location self._pan_data = (event.x, event.y)
Example #28
Source File: 8.13_3D_graphics.py From Tkinter-GUI-Application-Development-Blueprints-Second-Edition with MIT License | 5 votes |
def draw_cube(self): cube_points = [[0, 1, 2, 4], [3, 1, 2, 7], [5, 1, 4, 7], [6, 2, 4, 7]] w = self.canvas.winfo_width() / 2 h = self.canvas.winfo_height() / 2 self.canvas.delete(ALL) for i in cube_points: for j in i: self.canvas.create_line( self.translate_vector(self.cube[0][i[0]], self.cube[1][i[0]], w, h), self.translate_vector(self.cube[0][j], self.cube[1][j], w, h), fill=self.fg_color)
Example #29
Source File: 6.09.py From Tkinter-GUI-Application-Development-Blueprints-Second-Edition with MIT License | 5 votes |
def start_new_project(self): self.canvas.delete(ALL) self.canvas.config(bg="#ffffff") self.root.title('untitled')
Example #30
Source File: 6.09.py From Tkinter-GUI-Application-Development-Blueprints-Second-Edition with MIT License | 5 votes |
def canvas_zoom_in(self): self.canvas.scale("all", 0, 0, 1.2, 1.2) self.canvas.config(scrollregion=self.canvas.bbox(tk.ALL))