本文整理汇总了Python中panel.Panel.activate方法的典型用法代码示例。如果您正苦于以下问题:Python Panel.activate方法的具体用法?Python Panel.activate怎么用?Python Panel.activate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类panel.Panel
的用法示例。
在下文中一共展示了Panel.activate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from panel import Panel [as 别名]
# 或者: from panel.Panel import activate [as 别名]
class Face:
def __init__(self, root):
self.config = Config("tkc.ini")
root.title("Tkinter Commander")
root.protocol("WM_DELETE_WINDOW", self.on_delete)
self.root = root
root.geometry(self.config.get("fm_geometry"))
root.grid_columnconfigure(0, weight=1)
root.grid_rowconfigure(1, weight=1)
pw = Panedwindow(root, orient="horizontal", takefocus=False)
frame = Frame(pw)
self.left = Panel(frame, Local_fs(), self.config)
pw.add(frame)
pw.pane(frame, weight=1)
frame = Frame(pw)
self.right = Panel(frame, Local_fs(), self.config)
self.right.oposite = ref(self.left)
self.left.oposite = ref(self.right)
self.left.activate()
pw.add(frame)
pw.pane(frame, weight=1)
pw.grid(column=0, row=1, columnspan=2, sticky="senw")
self.add_menu()
self.add_btns()
root.tk.call(
"wm", "iconphoto", root._w,
PhotoImage(file=join(dirname(__file__), "data", "favicon.gif")))
def add_menu(self):
top = self.root
top["menu"] = menubar = Menu(top)
menu_file = Menu(menubar)
menu_settings = Menu(menubar)
menu_help = Menu(menubar)
menubar.add_cascade(menu=menu_file, label=_("File"))
menubar.add_cascade(menu=menu_settings, label=_("Settings"))
menubar.add_cascade(menu=menu_help, label=_("Help"))
menu_settings.add_command(label=_("Pannel Settings"),
command=self.dlg_panset)
def add_btns(self):
root = self.root
frame = Frame(root)
for key, text, command in (
(3, _("F3 View"), self.on_F3),
(4, _("F4 Edit"), self.on_F4), (5, _("F5 Copy"), self.on_F5),
(6, _("F6 Move"), self.on_F6),
(7, _("F7 Make Directory"), self.on_F7),
(8, _("F8 Remove"), self.on_F8),
(10, _("F10 Exit"), self.on_F10)):
btn = Button(frame, text=text, command=command, takefocus=False)
btn.pack(side="left", fill="x", expand=True)
root.bind_all("<F%d>" % key, func=command)
sz = Sizegrip(frame)
sz.pack(side="right", anchor="se")
frame.grid(column=0, row=2, columnspan=2, sticky="we")
def get_panels(self):
"returns (active, passive) panels"
if self.left.is_active:
return self.left, self.right
return self.right, self.left
def on_delete(self):
self.config["fm_geometry"] = self.root.geometry()
self.config.save()
self.root.destroy()
def on_F3(self, evt=None):
print("F3")
def on_F4(self, evt=None):
print("F4")
def on_F5(self, evt=None):
buttons.copy_button(self)
def on_F6(self, evt=None):
print("F6")
def on_F7(self, evt=None):
print("F7")
def on_F8(self, evt=None):
print("F8")
def on_F10(self, evt=None):
self.on_delete()
def dlg_panset(self):
from dialogs import Dlg_panset
Dlg_panset(self.root, self.config)