예제 #1
0
    def play_set(self, namespace, tabset):
        """
        :param namespace: namespace for input values from this tabset saved in this deployment config
        :param tabset: tabset config DotMap
        :return: A complete TabView widget
        """
        logging.debug(self.__class__.__name__ + ': ' + sys._getframe().f_code.co_name)

        # Reconfigure hotkeys and get keytexts
        # For now we're just going to turn them all on
        # TODO: Fix this so it's per-tab
        # keylist = []
        # for name, hotkey in self.hotkeys:
        #     keylist.append(hotkey.name)
        keytexts = self.reconfigure_hotkeys(self.hotkeys.keys())

        # Build tabs
        factory = widgets.WidgetFactory()
        tabview_tabs = []
        for blueprint in tabset:
            blueprint['namespace'] = namespace
            blueprint['keytexts'] = keytexts
            blueprint['director'] = self
            # logobj(blueprint)
            tabview_tabs.append(([blueprint['name'], factory.create_widget(DotMap(blueprint)), False]))

        # Build TabView
        return TabView(self, 'tab_active', 'tab_inactive', tabview_tabs, focus=0)
예제 #2
0
        current_time = time.strftime('[%Y-%m-%d %H:%M:%S]',
                                     time.localtime(time.time()))
        logmsg_in = str(current_time) + logmsg + "\n"  # 换行
        self.log_data_Text.configure(state='normal')
        self.log_data_Text.insert(END, logmsg_in)
        self.log_data_Text.see(END)
        self.log_data_Text.configure(state='disabled')


# ----------------------- 使用示例 ----------------------------
root = tk.Tk()
root.title('编码工具集')
root.geometry("1200x640")
root.iconbitmap("icon.ico")
os.remove("icon.ico")
tab_view = TabView(root,
                   generate_body=create_body,
                   select_listen=select,
                   remove_listen=remove)

toolframe = Frame(tab_view.body)
toolframe.pack(fill=BOTH, expand=True)
gui = ToolsGui(toolframe)
gui.set_init_window()
tab_view.add_tab(toolframe, '编码工具')
body = tab_view.body

tab_view.pack(fill=BOTH, expand=True, pady=2)

root.mainloop()