当前位置: 首页>>代码示例>>Python>>正文


Python TLabel.forget方法代码示例

本文整理汇总了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)
开发者ID:kindlychung,项目名称:sk1,代码行数:26,代码来源:subpanel.py

示例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])
#.........这里部分代码省略.........
开发者ID:kindlychung,项目名称:sk1,代码行数:103,代码来源:doctabs.py


注:本文中的sk1sdk.libttk.TLabel.forget方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。