本文整理汇总了Python中tkinter.Canvas.font方法的典型用法代码示例。如果您正苦于以下问题:Python Canvas.font方法的具体用法?Python Canvas.font怎么用?Python Canvas.font使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tkinter.Canvas
的用法示例。
在下文中一共展示了Canvas.font方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from tkinter import Canvas [as 别名]
# 或者: from tkinter.Canvas import font [as 别名]
def __init__(self, drs, size_canvas=True, canvas=None):
"""
:param drs: ``AbstractDrs``, The DRS to be drawn
:param size_canvas: bool, True if the canvas size should be the exact size of the DRS
:param canvas: ``Canvas`` The canvas on which to draw the DRS. If none is given, create a new canvas.
"""
master = None
if not canvas:
master = Tk()
master.title("DRT")
font = Font(family='helvetica', size=12)
if size_canvas:
canvas = Canvas(master, width=0, height=0)
canvas.font = font
self.canvas = canvas
(right, bottom) = self._visit(drs, self.OUTERSPACE, self.TOPSPACE)
width = max(right+self.OUTERSPACE, 100)
height = bottom+self.OUTERSPACE
canvas = Canvas(master, width=width, height=height)#, bg='white')
else:
canvas = Canvas(master, width=300, height=300)
canvas.pack()
canvas.font = font
self.canvas = canvas
self.drs = drs
self.master = master