本文整理汇总了Python中tk_tools.TK_ROOT.call方法的典型用法代码示例。如果您正苦于以下问题:Python TK_ROOT.call方法的具体用法?Python TK_ROOT.call怎么用?Python TK_ROOT.call使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tk_tools.TK_ROOT
的用法示例。
在下文中一共展示了TK_ROOT.call方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: init
# 需要导入模块: from tk_tools import TK_ROOT [as 别名]
# 或者: from tk_tools.TK_ROOT import call [as 别名]
def init(cback):
global callback, labels, win, is_open
callback = cback
is_open = False
win = Toplevel(TK_ROOT)
win.title("BEE2")
win.resizable(False, False)
win.iconbitmap('../BEE2.ico')
win.protocol("WM_DELETE_WINDOW", exit_win)
win.transient(TK_ROOT)
win.withdraw()
if utils.MAC:
# Switch to use the 'modal' window style on Mac.
TK_ROOT.call(
'::tk::unsupported::MacWindowStyle',
'style',
win,
'moveableModal',
''
)
frame = ttk.Frame(win, padding=10)
frame.grid(row=0, column=0, sticky='NSEW')
frame.rowconfigure(0, weight=1)
frame.columnconfigure(0, weight=1)
labels['noOptions'] = ttk.Label(frame, text='No Properties avalible!')
widgets['saveButton'] = ttk.Button(frame, text='Close', command=exit_win)
widgets['titleLabel'] = ttk.Label(frame, text='')
widgets['titleLabel'].grid(columnspan=9)
widgets['div_1'] = ttk.Separator(frame, orient="vertical")
widgets['div_2'] = ttk.Separator(frame, orient="vertical")
widgets['div_h'] = ttk.Separator(frame, orient="horizontal")
for key, (prop_type, prop_name) in PROP_TYPES.items():
labels[key] = ttk.Label(frame, text=prop_name+':')
if prop_type == 'checkbox':
values[key] = IntVar(value=DEFAULTS[key])
out_values[key] = utils.bool_as_int(DEFAULTS[key])
widgets[key] = ttk.Checkbutton(
frame,
variable=values[key],
command=func_partial(set_check, key),
)
widgets[key].bind(
'<Return>',
func_partial(
toggleCheck,
key,
values[key],
)
)
elif prop_type == 'railLift':
values[key] = IntVar(value=DEFAULTS[key])
out_values[key] = utils.bool_as_int(DEFAULTS[key])
widgets[key] = ttk.Checkbutton(
frame,
variable=values[key],
command=func_partial(save_rail, key),
)
elif prop_type == 'panAngle':
frm = ttk.Frame(frame)
widgets[key] = frm
values[key] = StringVar(value=DEFAULTS[key])
for pos, angle in enumerate(['30', '45', '60', '90']):
ttk.Radiobutton(
frm,
variable=values[key],
value=angle,
text=angle,
command=func_partial(save_angle, key, angle),
).grid(row=0, column=pos)
frm.columnconfigure(pos, weight=1)
elif prop_type == 'gelType':
frm = ttk.Frame(frame)
widgets[key] = frm
values[key] = IntVar(value=DEFAULTS[key])
for pos, text in enumerate(PAINT_OPTS):
ttk.Radiobutton(
frm,
variable=values[key],
value=pos,
text=text,
command=func_partial(save_paint, key, pos),
).grid(row=0, column=pos)
frm.columnconfigure(pos, weight=1)
out_values[key] = str(DEFAULTS[key])
elif prop_type == 'pistPlat':
widgets[key] = Scale(
frame,
from_=0,
to=4,
orient="horizontal",
showvalue=False,
#.........这里部分代码省略.........
示例2: init
# 需要导入模块: from tk_tools import TK_ROOT [as 别名]
# 或者: from tk_tools.TK_ROOT import call [as 别名]
def init(cback):
global callback, labels, win, is_open
callback = cback
is_open = False
win = Toplevel(TK_ROOT)
win.title("BEE2")
win.resizable(False, False)
tk_tools.set_window_icon(win)
win.protocol("WM_DELETE_WINDOW", exit_win)
win.transient(TK_ROOT)
win.withdraw()
if utils.MAC:
# Switch to use the 'modal' window style on Mac.
TK_ROOT.call(
'::tk::unsupported::MacWindowStyle',
'style',
win,
'moveableModal',
''
)
frame = ttk.Frame(win, padding=10)
frame.grid(row=0, column=0, sticky='NSEW')
frame.rowconfigure(0, weight=1)
frame.columnconfigure(0, weight=1)
labels['noOptions'] = ttk.Label(frame, text=_('No Properties available!'))
widgets['saveButton'] = ttk.Button(frame, text=_('Close'), command=exit_win)
widgets['titleLabel'] = ttk.Label(frame, text='')
widgets['titleLabel'].grid(columnspan=9)
widgets['div_1'] = ttk.Separator(frame, orient="vertical")
widgets['div_2'] = ttk.Separator(frame, orient="vertical")
widgets['div_h'] = ttk.Separator(frame, orient="horizontal")
for key, (prop_type, prop_name) in PROP_TYPES.items():
# Translate property names from Valve's files.
if prop_name.startswith('PORTAL2_'):
prop_name = gameMan.translate(prop_name) + ':'
labels[key] = ttk.Label(frame, text=prop_name)
if prop_type is PropTypes.CHECKBOX:
values[key] = IntVar(value=DEFAULTS[key])
out_values[key] = srctools.bool_as_int(DEFAULTS[key])
widgets[key] = ttk.Checkbutton(
frame,
variable=values[key],
command=func_partial(set_check, key),
)
widgets[key].bind(
'<Return>',
func_partial(
toggleCheck,
key,
values[key],
)
)
elif prop_type is PropTypes.OSCILLATE:
values[key] = IntVar(value=DEFAULTS[key])
out_values[key] = srctools.bool_as_int(DEFAULTS[key])
widgets[key] = ttk.Checkbutton(
frame,
variable=values[key],
command=func_partial(save_rail, key),
)
elif prop_type is PropTypes.PANEL:
frm = ttk.Frame(frame)
widgets[key] = frm
values[key] = StringVar(value=DEFAULTS[key])
for pos, (angle, disp_angle) in enumerate(PANEL_ANGLES):
ttk.Radiobutton(
frm,
variable=values[key],
value=angle,
text=gameMan.translate(disp_angle),
command=func_partial(save_angle, key, angle),
).grid(row=0, column=pos)
frm.columnconfigure(pos, weight=1)
elif prop_type is PropTypes.GELS:
frm = ttk.Frame(frame)
widgets[key] = frm
values[key] = IntVar(value=DEFAULTS[key])
for pos, text in enumerate(PAINT_OPTS):
ttk.Radiobutton(
frm,
variable=values[key],
value=pos,
text=gameMan.translate(text),
command=func_partial(save_paint, key, pos),
).grid(row=0, column=pos)
frm.columnconfigure(pos, weight=1)
out_values[key] = str(DEFAULTS[key])
elif prop_type is PropTypes.PISTON:
widgets[key] = Scale(
frame,
#.........这里部分代码省略.........