-
Notifications
You must be signed in to change notification settings - Fork 0
/
dogui.py
38 lines (30 loc) · 1.06 KB
/
dogui.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env python3
from traitsui.api import Item, RangeEditor, View
from traits.api import HasTraits, Str, Range, Enum, Int
from traits.api import *
from traitsui.api import *
from tvtk.pyface.scene_editor import SceneEditor
from mayavi.tools.mlab_scene_model import MlabSceneModel
from mayavi.core.ui.mayavi_scene import MayaviScene
view1 = View(
Item(name='scene',
editor=SceneEditor(scene_class=MayaviScene), # 设置mayavi的编辑器
resizable=True,
height=250,
width=400
),
Item(name = 'department', label=u"部门", tooltip=u"在哪个部门干活"),
Item(name = 'last_name', label=u"姓"),
Item(name = 'first_name', label=u"名"), resizable = True,
width = 400,
height = 150)
class SimpleEmployee(HasTraits):
first_name = Str
last_name = Str
department = Str
employee_number = Str
salary = Int
plotbutton = Button(u"绘图")
scene = Instance(MlabSceneModel, ()) # mayavi场景
sam = SimpleEmployee()
sam.configure_traits(view=view1)