本文整理汇总了Python中sk1sdk.libttk.TLabel.grid方法的典型用法代码示例。如果您正苦于以下问题:Python TLabel.grid方法的具体用法?Python TLabel.grid怎么用?Python TLabel.grid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sk1sdk.libttk.TLabel
的用法示例。
在下文中一共展示了TLabel.grid方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: build_status_bar
# 需要导入模块: from sk1sdk.libttk import TLabel [as 别名]
# 或者: from sk1sdk.libttk.TLabel import grid [as 别名]
def build_status_bar(self):
status_bar = self.status_bar
canvas = self.canvas
#Container
sb1 = TFrame(status_bar, style="FlatFrame")
sb1.pack(side=LEFT, fill=Y)
#Position Info
stat_pos = PositionLabel(sb1, name='position', text='', anchor='center', width=20, updatecb=canvas.GetCurrentPos)
stat_pos.pack(side=LEFT, fill=X)
stat_pos.Update()
canvas.Subscribe(POSITION, stat_pos.Update)
sb_frame2 = TFrame(status_bar, style="RoundedSBFrame", borderwidth=2)
sb_frame2.pack(side=LEFT, fill=BOTH)
#OnGrid
b = ToolbarCheckbutton(sb_frame2, canvas.commands.ToggleSnapToGrid, image='snap_to_grid')
b.pack(side=LEFT)
tooltips.AddDescription(b, canvas.commands.ToggleSnapToGrid.menu_name)
label = TLabel(sb_frame2, image="sb_sep")
label.pack(side=LEFT)
#OnGuide
b = ToolbarCheckbutton(sb_frame2, canvas.commands.ToggleSnapToGuides, image='snap_to_guide')
b.pack(side=LEFT)
tooltips.AddDescription(b, canvas.commands.ToggleSnapToGuides.menu_name)
label = TLabel(sb_frame2, image="sb_sep")
label.pack(side=LEFT)
#OnObject
b = ToolbarCheckbutton(sb_frame2, canvas.commands.ToggleSnapToObjects, image='snap_to_object')
b.pack(side=LEFT)
tooltips.AddDescription(b, canvas.commands.ToggleSnapToObjects.menu_name)
label = TLabel(sb_frame2, image="sb_sep")
label.pack(side=LEFT)
#ForceRedraw
b = ToolbarButton(sb_frame2, canvas.commands.ForceRedraw, image='statusbar_refresh')
b.pack(side=LEFT)
tooltips.AddDescription(b, canvas.commands.ForceRedraw.menu_name)
#Zoom Info
#l=Label(status_bar, anchor=SW, text=' Zoom:')
#l.pack(side='left')
#stat_zoom = UpdatedLabel(status_bar, name = 'zoom', text = '', updatecb = canvas.ZoomInfoText)
#stat_zoom.pack(side = 'left')
#stat_zoom.Update()
#canvas.Subscribe(VIEW, stat_zoom.Update)
#stat_edited = UpdatedLabel(status_bar, name = 'edited', text = '',
# updatecb = self.EditedInfoText)
#stat_edited.pack(side = 'left')
#stat_edited.Update()
#self.Subscribe(UNDO, stat_edited.Update)
#Selection Color switch
def ColorInfo():
if len(self.document.selection) != 1 or self.document.CanUngroup():
fill_frame["style"] = 'ColorWatchDisabled'
outline_frame["style"] = 'ColorWatchDisabled'
fill_frame['background'] = app.uimanager.currentColorTheme.bg
outline_frame['background'] = app.uimanager.currentColorTheme.bg
return ""
properties = self.document.CurrentProperties()
filltxt = ''
outlinetxt = ''
try:
fill_frame["style"] = 'ColorWatchNormal'
fillcolor = rgb_to_tk(properties.fill_pattern.Color().RGB())
fill_frame["background"] = fillcolor
filltxt = _('Fill:') + ' ' + properties.fill_pattern.Color().toString()
except:
fill_frame["style"] = 'ColorWatchTransp'
filltxt = _('Fill: None')
try:
outline_frame["style"] = 'ColorWatchNormal'
outline_frame["background"] = rgb_to_tk(properties.line_pattern.Color().RGB())
outlinetxt = _('Outline:') + ' ' + str(math.ceil(math.floor(10 ** 4 * properties.line_width / 2.83465) / 10) / 1000) + ' mm'
except:
outline_frame["style"] = 'ColorWatchTransp'
outlinetxt = _('Outline: None')
return filltxt + "\n" + outlinetxt
space = Frame(status_bar, relief='flat', width=5)
space.pack(side=RIGHT, fill=Y)
sb3f = Frame(status_bar, relief='flat', borderwidth=1, width=20, height=15)
sb3f.pack(side=RIGHT)
fill_frame = TLabel(sb3f, style='ColorWatchDisabled', image='space_12')
#.........这里部分代码省略.........