本文整理汇总了Python中tkinter.Frame.forget方法的典型用法代码示例。如果您正苦于以下问题:Python Frame.forget方法的具体用法?Python Frame.forget怎么用?Python Frame.forget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tkinter.Frame
的用法示例。
在下文中一共展示了Frame.forget方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from tkinter import Frame [as 别名]
# 或者: from tkinter.Frame import forget [as 别名]
#.........这里部分代码省略.........
Label(self.frame,
text=_convert(name),
justify=LEFT).grid(
row=count,
column=1
)
# self.entrys[_convert(name)] = ""
sv = StringVar(
value=default_params[block_name][name][0])
e = Entry(self.frame)
self.entrys[name] = sv
self.funcs[e] = func
e.config(validate='key',
vcmd=(_vcmd, "%P", "%W"),
textvariable=sv)
e.grid(row=count,
column=2)
count += 1
Label(self.frame,
text="Количество существ:",
justify=LEFT).grid(
row=count,
column=1
)
self.creature_count = \
Label(self.frame,
text='0',
justify=LEFT)
self.creature_count.grid(
row=count,
column=2
)
def _buttons_init(self):
self.load_button = Button(self.frame,
text='Загрузить',
command=self.load_button_press)
self.load_button.grid(row=4 + default_fields_count,
column=1)
self.start_button = Button(self.frame,
text='Старт',
command=self.start_button_press)
self.start_button.grid(row=4 + default_fields_count,
column=2)
self.master.protocol('WM_DELETE_WINDOW',
self.exit)
def _validate(self, P, W):
e = self.frame.nametowidget(W)
func = self.funcs[e]
try:
func(P)
except ValueError:
return False
else:
return True
def _collect_params(self):
params = deepcopy(default_params)
for block in params.values():
for key in block:
func = block[key][1]
block[key] = func(self.entrys[key].get())
return params
def start_button_press(self):
params = self._collect_params()
if self.controller.model:
self.game_screen = GameScreen(self.master, params, model=self.controller.model)
else:
self.game_screen = GameScreen(self.master, params)
self.frame.forget()
def load_button_press(self):
self.controller.load_button_press()
model = self.controller.model
self.creature_count.config(text=str(len(model.creatures)))
for block in model.params.values():
for k, v in block.items():
if k == "in_layers":
v = ", ".join([str(x) for x in v])
self.entrys[k].set(v)
def exit(self):
exit()