本文整理汇总了Python中sk1sdk.libttk.TLabel.forget方法的典型用法代码示例。如果您正苦于以下问题:Python TLabel.forget方法的具体用法?Python TLabel.forget怎么用?Python TLabel.forget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sk1sdk.libttk.TLabel
的用法示例。
在下文中一共展示了TLabel.forget方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from sk1sdk.libttk import TLabel [as 别名]
# 或者: from sk1sdk.libttk.TLabel import forget [as 别名]
class CtxSubPanel:
def __init__(self, parent):
self.receivers={}
self.parent=parent
self.mw=self.parent.mainwindow
self.doc=self.parent.mainwindow.document
self.panel=TFrame(parent.panel, style='FlatFrame', borderwidth=0)
self.separator = TLabel(self.panel, image = "toolbar_sep")
self.mw.Subscribe(DOCUMENT, self.doc_changed)
self.setNormal()
def ReSubscribe(self):
pass
def doc_changed(self, doc):
self.doc=doc
self.ReSubscribe()
def setLast(self):
self.separator.forget()
def setNormal(self):
self.separator.pack(side = RIGHT, padx=2)
示例2: TabsPanel
# 需要导入模块: from sk1sdk.libttk import TLabel [as 别名]
# 或者: from sk1sdk.libttk.TLabel import forget [as 别名]
class TabsPanel(TFrame, Publisher):
content = []
stub = 1
docmanager = None
def __init__(self, parent, mainwindow):
self.parent = parent
self.mainwindow = mainwindow
TFrame.__init__(self, self.parent, name='tabsPanel', style='FlatFrame',
borderwidth=0)
self.left_label = TLabel(self, style=LEFT_CORNER, image='space_3')
self.right_label = TLabel(self, style=RIGHT_CORNER, image='space_3')
self.stub_label = TLabel(self, style='DrawingAreaTop', image='space_5')
self.stub_label.pack(side=TOP, fill=X)
def ReSubscribe(self):
self.docmanager.activedoc.Subscribe(UNDO, self.check_save_status)
self.check_save_status()
def check_save_status(self):
for item in self.content:
if item.is_Active:
if self.docmanager.activedoc.WasEdited():
item.setNotSaved()
else:
item.setNotSaved(1)
self.updateTabNames()
def refresh(self):
self.stub_label.foget()
for item in self.content:
item.forget()
if len(self.content) < 2:
self.stub_label.pack(side=TOP, fill=X)
else:
for item in self.content:
item.pack(side=LEFT)
def check_state(self):
if len(self.content) > 1 and self.stub:
self.stub_label.forget()
self.left_label.pack(side=LEFT, fill=Y)
for item in self.content:
item.pack(side=LEFT)
self.right_label.pack(side=BOTTOM, fill=X)
self.stub = 0
return 0
if len(self.content) < 2 and self.stub == 0:
self.left_label.forget()
for item in self.content:
item.forget()
self.right_label.forget()
self.stub_label.pack(side=TOP, fill=X)
self.stub = 1
return 0
return 1
def stub(self):
pass
def setActive(self, tab):
if not tab.is_Active:
for item in self.content:
item.setNonActive()
tab.setActive()
self.docmanager.SetActiveDocument(tab.document)
self.ReSubscribe()
if self.content[0].is_Active:
self.left_label["style"] = LEFT_CORNER_ACTIVE
else:
self.left_label["style"] = LEFT_CORNER
def addNewTab(self, doc):
if doc.meta.fullpathname:
name = doc.meta.filename
else:
name = os.path.splitext(doc.meta.filename)[0]
tab = DocTab(self, name, document=doc)
self.content.append(tab)
if self.check_state() and self.stub == 0:
self.right_label.forget()
tab.pack(side=LEFT, fill=Y)
self.right_label.pack(side=BOTTOM, fill=X)
self.setActive(tab)
return tab
def closeTab(self, tab, exit_state=False):
result = self.docmanager.save_doc_if_edited(tab.document)
index = self.content.index(tab)
if not result == msgdialog.Cancel:
self.content.remove(tab)
if not len(self.content):
if not exit_state:
self.docmanager.NewDocument()
else:
if tab.is_Active:
if index == len(self.content):
self.setActive(self.content[index - 1])
#.........这里部分代码省略.........