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


Python TFrame.destroy方法代码示例

本文整理汇总了Python中sk1sdk.libttk.TFrame.destroy方法的典型用法代码示例。如果您正苦于以下问题:Python TFrame.destroy方法的具体用法?Python TFrame.destroy怎么用?Python TFrame.destroy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sk1sdk.libttk.TFrame的用法示例。


在下文中一共展示了TFrame.destroy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: destroy

# 需要导入模块: from sk1sdk.libttk import TFrame [as 别名]
# 或者: from sk1sdk.libttk.TFrame import destroy [as 别名]
	def destroy(self):
		self.entry.unbind_all(self.entry)
		self.entry.destroy()
		self.button_frame.destroy()
		self.up_button.destroy()
		self.down_button.destroy()
		self.command = self.args = None
		TFrame.destroy(self)
开发者ID:kindlychung,项目名称:sk1,代码行数:10,代码来源:ttk_ext.py

示例2: TSpinbox

# 需要导入模块: from sk1sdk.libttk import TFrame [as 别名]
# 或者: from sk1sdk.libttk.TFrame import destroy [as 别名]

#.........这里部分代码省略.........
			self.variable=float(self.variable)
		else:
			self.variable=int(self.variable)
		self.text_var.set(str(self.variable))
		self.entry.bind('<Button-4>', self.wheel_increase)
		self.entry.bind('<Button-5>', self.wheel_decrease)
		self.entry.bind('<Key-Up>', self.wheel_increase)
		self.entry.bind('<Key-Down>', self.wheel_decrease)
		self.entry.bind('<Key-Return>', self.apply_command)
		self.entry.bind('<Key-KP_Enter>', self.apply_command)
		#self.entry.bind ( '<KeyPress>', self.check_input)
		
	def check_input(self, event):
		event=None
	
	def apply_command(self, *args):
		if self.state==NORMAL:
			text = self.entry.get()
			text = text.replace(',', '.')
			text = text.replace('/', '*1./')
			if text and not expression.search(text):
				try:
					variable = eval(text)
				except:
					pass
				else:
					self.set_value(variable)
					self.command(*args)
		
	def set_state(self, state):
		self.state=state
		self.entry.configure(state = state)
		self.up_button.configure(state = state)
		self.down_button.configure(state = state)
		
	def get_state(self):
		return self.state
		
	def wheel_increase(self, event):
		self.increase()
		
	def wheel_decrease(self, event):
		self.decrease()
		
	def increase(self):
		if self.state==NORMAL:
			try:
				self.variable=float(self.text_var.get())
			except:
				self.text_var.set('0')
				self.variable=float(self.text_var.get())
			self.variable=self.variable+self.step
			
			self.set_value(self.variable)
		
	def decrease(self):
		if self.state==NORMAL:
			try:
				self.variable=float(self.text_var.get())
			except:
				self.text_var.set('0')
				self.variable=float(self.text_var.get())
			self.variable=self.variable-self.step
			
			self.set_value(self.variable)
		
	def set_value(self, value=0):
		try:
			value = float(value)
		except:
			value = 0
		value = min(self.max_value, value)
		value = max(self.min_value, value)
		if self.vartype == 1: 
			self.variable = float(value)
		else:
			self.variable = int(round(value))
		self.text_var.set(str(self.variable))
	
	def get_value(self):
		try:
			self.variable=float(self.text_var.get())
		except:
			self.text_var.set('0')
			self.variable=float(self.text_var.get())
		if self.vartype==1: 
			self.variable=float(self.variable)
		else:
			self.variable = int(round(self.variable))
		return self.variable
			
		
	def destroy(self):
		self.entry.unbind_all(self.entry)
		self.entry.destroy()
		self.button_frame.destroy()
		self.up_button.destroy()
		self.down_button.destroy()
		self.command = self.args = None
		TFrame.destroy(self)
开发者ID:kindlychung,项目名称:sk1,代码行数:104,代码来源:ttk_ext.py


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