2
A
回答
2
查找文檔的最佳位置是Envisage源代碼樹中的Acmelab example。
我假設你談論自定義按鈕時,你是指工具欄上的按鈕。首先,您需要創建一個WorkbenchActionSet,在其中添加工具欄,然後定義您的操作併爲其分配一個按鈕圖像。下面是與非相關部分(略有修改)Acmelab例中取出:
test_action_set.py
# Enthought library imports.
from envisage.ui.action.api import Action, Group, Menu, ToolBar
from envisage.ui.workbench.api import WorkbenchActionSet
class TestActionSet(WorkbenchActionSet):
""" An action test useful for testing. """
#### 'ActionSet' interface ################################################
tool_bars = [
ToolBar(name='Fred', groups=['AToolBarGroup']),
ToolBar(name='Wilma'),
ToolBar(name='Barney')
]
actions = [
Action(
path='ToolBar',
class_name='acme.workbench.action.new_view_action:NewViewAction'
),]
new_view_action.py
""" An action that dynamically creates and adds a view. """
# Enthought library imports.
from pyface.api import ImageResource
from pyface.action.api import Action
from pyface.workbench.api import View
class NewViewAction(Action):
""" An action that dynamically creates and adds a view. """
#### 'Action' interface ###################################################
# A longer description of the action.
description = 'Create and add a new view'
# The action's name (displayed on menus/tool bar tools etc).
name = 'New View'
# A short description of the action used for tooltip text etc.
tooltip = 'Create and add a new view'
image = ImageResource(Your Image File Name Goes Here)
###########################################################################
# 'Action' interface.
###########################################################################
def perform(self, event):
""" Perform the action. """
# You can give the view a position... (it default to 'left')...
view = View(id='my.view.fred', name='Fred', position='right')
self.window.add_view(view)
# or you can specify it on the call to 'add_view'...
view = View(id='my.view.wilma', name='Wilma')
self.window.add_view(view, position='top')
return
#### EOF ######################################################################
相關問題
- 1. 想在運行時設置框架
- 2. 需要幫助設置Python Flask框架
- 3. 在Python中設計測試框架!
- 4. Zend框架2和想象
- 5. C2DM Python框架
- 6. Python Web框架
- 7. Python框架 - 列表框
- 8. Python解析框架
- 9. Python報告框架
- 10. Python視頻框架
- 11. PyXB和python框架
- 12. Python的TK框架
- 13. Zend框架和設想一下:在圖像
- 14. 設置UIView框架
- 15. 設置Zend框架
- 16. Zend框架設置
- 17. 想要在mkmapview中添加框架
- 18. 實體框架查詢想法(按組)
- 19. SubView不想適合指定的框架
- 20. 我想在Ionic框架中實現webview.postUrl
- 21. Python web框架php一樣
- 22. Python KMeans橙色框架
- 23. 扭曲的框架Python
- 24. Python的繼承 - 框架
- 25. Python - 微型網絡框架 -
- 26. 可滾動框架Python Tkinter
- 27. 分析與Python瓶框架
- 28. 什麼是python web框架
- 29. 的Python HTML解析框架
- 30. 子框架不摧毀python
我想創建一個用戶接口,具有按鈕,我們從傳感器接收數據,並且我們需要一些帶有動作(任務)的按鈕,並且我們希望使用Mayavi進行繪圖,但是由於插件系統,我們選擇了這個框架,但不幸的是沒有一個很好的文檔框架。 –
在這種情況下,您可能想要使用基於TraitsUI的東西。 http://code.enthought.com/projects/traits/docs/html/TUIUG/index.html –
是否可以使用插件進行擴展? –