本文整理汇总了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)
示例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)