0

I'm new to python and wxPython.
I have a question concerning the application structure for the following:
There is a base module, the main module.
This main module gets called at the beginning.
In this module happens the bootstrapping and the switching from one component to another.
The main module shows the main frame, in the upper area there is a tool bar.
In this toolbar there is a text field to enter the code for the component, for example "todo" or "wiki".
The area below the tool bar is empty at the beginning. This is the place where the gui for the selected component should be placed.
My question is now:
The user types in the code for the selected component, for example "todo".
Then I have to dynamically load the module for this component and place the view of this module in the lower section of the parent (main) module. How do I do this?
Thanks alot in advance

4

1 回答 1

1

为模块名称创建关键字字典,然后通过在字典中搜索键来加载模块。

例如:

from interface.modules import Wiki, Search, Web, Default

modules = {'wiki': Wiki, 'search': Search, 'Internet': Web, 'browser': Web}

module_to_load = modules.get(user_input, Default)

view.load(module_to_load)
于 2013-05-15T06:02:25.077 回答