本文整理汇总了Python中tkinter.ALL属性的典型用法代码示例。如果您正苦于以下问题:Python tkinter.ALL属性的具体用法?Python tkinter.ALL怎么用?Python tkinter.ALL使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类tkinter
的用法示例。
在下文中一共展示了tkinter.ALL属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: center_on_node
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import ALL [as 别名]
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)
示例2: draw_puzzle
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import ALL [as 别名]
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)
示例3: delete_marker
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import ALL [as 别名]
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)
示例4: _zoom
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import ALL [as 别名]
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]))
示例5: _zoom_in
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import ALL [as 别名]
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)
示例6: _zoom_out
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import ALL [as 别名]
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)
示例7: drawGrid
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import ALL [as 别名]
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)
示例8: OnVideoListClick
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import ALL [as 别名]
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()
示例9: onPanMotion
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import ALL [as 别名]
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)
示例10: clear
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import ALL [as 别名]
def clear(self):
"""Clear the canvas and display graph"""
self.delete(tk.ALL)
self.dispG.clear()
示例11: clear_timeline
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import ALL [as 别名]
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)
示例12: _clearCanvas
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import ALL [as 别名]
def _clearCanvas(self, event):
self.history.clear()
self.canvas.delete(tkinter.ALL)
示例13: _undoCanvas
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import ALL [as 别名]
def _undoCanvas(self, event):
self.history.undo()
self.canvas.delete(tkinter.ALL)
self.history.execute()
示例14: on_canvas_resize
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import ALL [as 别名]
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)
示例15: update_scroll_region
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import ALL [as 别名]
def update_scroll_region(self):
''' Updates scrolling region.
'''
self.frame_with_boxes.update()
self.canvas['scrollregion'] = self.canvas.bbox(ALL)