本文整理汇总了Python中mglutil.gui.InputForm.Tk.gui.InputFormDescr.append方法的典型用法代码示例。如果您正苦于以下问题:Python InputFormDescr.append方法的具体用法?Python InputFormDescr.append怎么用?Python InputFormDescr.append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mglutil.gui.InputForm.Tk.gui.InputFormDescr
的用法示例。
在下文中一共展示了InputFormDescr.append方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: guiCallback
# 需要导入模块: from mglutil.gui.InputForm.Tk.gui import InputFormDescr [as 别名]
# 或者: from mglutil.gui.InputForm.Tk.gui.InputFormDescr import append [as 别名]
def guiCallback(self):
"""called each time the 'read ->AutoGrid' sequence is pressed"""
objList=[]
if len(self.vf.grids.keys())==0:
t='no grids currently in viewer'
self.warningMsg(t)
return
for item in self.vf.grids.keys():
if item not in objList:
objList.append(item)
if len(objList)==0:
gridName = objList[0]
else:
#NEED TO PICK THE GRID....
ifd2 = InputFormDescr(title='Choose Grid')
ifd2.append({'widgetType':'ListChooser',
'name':'gridObjs',
'entries':objList,
'wcfg':{'title':'Pick grid',
'mode':'single'},
'lbwcfg':{'height':4},
'gridcfg':{'sticky':'wens', 'column':100,
'rowspan':10}})
val = self.vf.getUserInput(ifd2)
if val is not None and len(val)>0 and len(val['gridObjs'])>0:
gridName = val['gridObjs'][0]
else:
return
return self.doitWrapper(gridName, redraw=0)
示例2: test_thumbwheel
# 需要导入模块: from mglutil.gui.InputForm.Tk.gui import InputFormDescr [as 别名]
# 或者: from mglutil.gui.InputForm.Tk.gui.InputFormDescr import append [as 别名]
def test_thumbwheel():
def tw_cb(event=None):
pass
from mglutil.gui.BasicWidgets.Tk.thumbwheel import ThumbWheel
descr = InputFormDescr(title = 'Testing InputForm')
descr.append({'name':'thumbwheel',
'widgetType':ThumbWheel,
'tooltip':"""Right click on the widget will display the control
panel and you can type a value manually""",
'defaultValue':100,
'wcfg':{'text':None,
'showLabel':1, 'width':100,
'min':0,
'lockBMin':1,
'lockBMax':1,
'lockBIncrement':1,
'value':40,
'oneTurn':1000,
'type':'int',
'increment':2,
'canvascfg':{'bg':'red'},
'wheelLabcfg1':{'font':(ensureFontCase('times'),14,'bold')},
'wheelLabcfg2':{'font':(ensureFontCase('times'),14,'bold')},
'callback':tw_cb,
'continuous':1, 'wheelPad':1, 'height':20},
'gridcfg':{'sticky':'e','row':-1}})
form = InputForm(master, root, descr)
value = form.testForm()
assert value['thumbwheel']==100
form.destroy()
示例3: guiCallback
# 需要导入模块: from mglutil.gui.InputForm.Tk.gui import InputFormDescr [as 别名]
# 或者: from mglutil.gui.InputForm.Tk.gui.InputFormDescr import append [as 别名]
def guiCallback(self):
objList = []
if len(self.vf.grids.keys()) == 0:
t = "no grids currently in viewer"
self.warningMsg(t)
return
for item in self.vf.grids.keys():
if item not in objList and not self.vf.grids[item].srf:
objList.append(item)
if not hasattr(self, "ifd"):
self.buildForm()
else:
self.form.deiconify()
if len(objList) > 0:
# NEED TO PICK THE GRID....
ifd2 = InputFormDescr(title="Choose Grid")
ifd2.append(
{
"widgetType": "ListChooser",
"name": "gridObjs",
"entries": objList,
"wcfg": {"title": "Pick grid", "mode": "single"},
"lbwcfg": {"height": 4},
"gridcfg": {"sticky": "wens", "column": 100, "rowspan": 10},
}
)
val = self.vf.getUserInput(ifd2)
if val is not None and len(val) > 0 and len(val["gridObjs"]) > 0:
filename = val["gridObjs"][0]
grid = self.vf.grids[filename]
return self.doitWrapper(filename, redraw=1)
示例4: buildFormDescr
# 需要导入模块: from mglutil.gui.InputForm.Tk.gui import InputFormDescr [as 别名]
# 或者: from mglutil.gui.InputForm.Tk.gui.InputFormDescr import append [as 别名]
def buildFormDescr(self, formName):
if formName=='saveViewsToFile':
if self.vf.commands.has_key("viewsPanel"):
if len(self.vf.viewsPanel.views) == 0:
return
else:
return
idf = InputFormDescr(title="Save Views to file")
idf.append({'name':'filename',
'widgetType':Pmw.EntryField,
'tooltip':"Enter the filename, a 'filename_oprient.py' (saves orientation)\nand 'filename_repr.db'(saves representation) will be created.",
'wcfg':{'label_text':'Filename:',
'labelpos':'w'},
'gridcfg':{'sticky':'we'},
})
idf.append({'widgetType':SaveButton,
'name':'filebrowse',
'wcfg':{'buttonType':Tkinter.Button,
'title':'Save In File ...',
'types':[('Views orientation','*_orient.py'),
('Views representation', '*_repr.db'),
("", '*')],
'callback':self.setEntry_cb,
'widgetwcfg':{'text':'BROWSE'}},
'gridcfg':{'row':-1, 'sticky':'we'}})
return idf
示例5: buildInputFormDescr
# 需要导入模块: from mglutil.gui.InputForm.Tk.gui import InputFormDescr [as 别名]
# 或者: from mglutil.gui.InputForm.Tk.gui.InputFormDescr import append [as 别名]
def buildInputFormDescr(self):
"""to be implemented by sub-class"""
ifd=InputFormDescr()
ifd.title = "bond picker"
ifd.append({'widgetType':Tkinter.Label,
'name':'event',
'wcfg':{'text':'event: '+self.event},
'gridcfg':{'sticky':Tkinter.W} })
ifd.append({'widgetType':Pmw.EntryField,
'name':'Atom1',
'wcfg':{'labelpos':'w',
'label_text':'Atom 1: ',
'validate':None},
'gridcfg':{'sticky':'we'}})
ifd.append({'widgetType':Pmw.EntryField,
'name':'Atom2',
'wcfg':{'labelpos':'w',
'label_text':'Atom 2: ',
'validate':None},
'gridcfg':{'sticky':'we'}})
ifd.append({'widgetType':Pmw.EntryField,
'name':'BondOrder',
'wcfg':{'labelpos':'w',
'label_text':'BondOrder: ',
'validate':None},
'gridcfg':{'sticky':'we'}})
if self.numberOfObjects==None:
ifd.append({'widgetType':Tkinter.Button,
'wcfg':{'text':'Done'},
'command': self.stop})
return ifd
示例6: getInt
# 需要导入模块: from mglutil.gui.InputForm.Tk.gui import InputFormDescr [as 别名]
# 或者: from mglutil.gui.InputForm.Tk.gui.InputFormDescr import append [as 别名]
def getInt(self):
idf = InputFormDescr(title='Choose a value')
idf.append({'widgetType':IntThumbWheel,
'name':'tw',
'wcfg':{'width':125, 'height':30, 'nblines':30}})
form = InputForm(master=self.widget.master, root = None, descr=idf)
values = form.go()
return values['tw']
示例7: buildFormDescr
# 需要导入模块: from mglutil.gui.InputForm.Tk.gui import InputFormDescr [as 别名]
# 或者: from mglutil.gui.InputForm.Tk.gui.InputFormDescr import append [as 别名]
def buildFormDescr(self, formName):
if formName == 'display':
idf = InputFormDescr(title = self.name)
idf.append({'name':'display',
'widgetType':Pmw.RadioSelect,
'listtext':['display','display only', 'undisplay'],
'defaultValue':'display',
'wcfg':{'orient':'horizontal',
'buttontype':'radiobutton'},
'gridcfg':{'sticky': 'we'}})
return idf
示例8: test_inputform_groupwidgetsdefault
# 需要导入模块: from mglutil.gui.InputForm.Tk.gui import InputFormDescr [as 别名]
# 或者: from mglutil.gui.InputForm.Tk.gui.InputFormDescr import append [as 别名]
def test_inputform_groupwidgetsdefault():
descr = InputFormDescr(title = 'Testing InputForm')
descr.append({'name':'group',
'widgetType':Tkinter.Radiobutton,
'listtext':['rb1', 'rb2', 'rb3'],
'defaultValue':'rb3',
'gridcfg':{'sticky':'w'}})
form = InputForm(master, root, descr)
value = form.testForm()
assert value['group']=='rb3'
form.destroy()
示例9: buildFormDescr
# 需要导入模块: from mglutil.gui.InputForm.Tk.gui import InputFormDescr [as 别名]
# 或者: from mglutil.gui.InputForm.Tk.gui.InputFormDescr import append [as 别名]
def buildFormDescr(self,formName):
if formName == "enterName":
ifd =InputFormDescr(title = "Pick Vect Name")
vectNames = self.vf.vectfield.keys()
ifd.append({'widgetType':Pmw.ComboBox,
'name':'vectName',
'required':1,
'tooltip': "Please type-in a new name or chose one from the list below\n '_' are not accepted",
'wcfg':{'labelpos':'nw',
'label_text':'VectField Name: ',
'entryfield_validate':self.entryValidate,
'scrolledlist_items':vectNames,
},
'gridcfg':{'sticky':'we'}})
return ifd
示例10: buildInputFormDescr
# 需要导入模块: from mglutil.gui.InputForm.Tk.gui import InputFormDescr [as 别名]
# 或者: from mglutil.gui.InputForm.Tk.gui.InputFormDescr import append [as 别名]
def buildInputFormDescr(self):
ifd = InputFormDescr()
all = self.allChoices()
if len(all)>0:
ifd.append({'widgetType':'ListChooser',
'name':'AllObjects',
'entries':all,
'title':'All objects',
'wcfg':{'mode':'multiple'},
})
if self.numberOfObjects==None:
ifd.append({'widgetType':Tkinter.Button,
'wcfg':{'text':'Done'},
'command': self.stop})
return ifd
示例11: test_inputForm_notebook
# 需要导入模块: from mglutil.gui.InputForm.Tk.gui import InputFormDescr [as 别名]
# 或者: from mglutil.gui.InputForm.Tk.gui.InputFormDescr import append [as 别名]
def test_inputForm_notebook():
descr = InputFormDescr(title = 'Testing InputForm')
descr.append({'widgetType':Pmw.NoteBook,
'name':'notebook',
'container':{'Page1':"w.page('Page1')",
'Page2':"w.page('Page2')",
'Page3':"w.page('Page3')"},
'wcfg':{'borderwidth':3},
'componentcfg':[{'name':'Page1', 'cfg':{}},
{'name':'Page2', 'cfg':{}},
{'name':'Page3', 'cfg':{}}],
'gridcfg':{'sticky':'wnse'}
})
entries = [('Chocolate',None), ('Vanilla', None), ('Strawberry', None),
('Coffee',None), ('Pistachio', None), ('Rasberry',None),
]
descr.append({'name':'listchooser',
'parent':'Page1',
'widgetType':ListChooser,
'defaultValue':'Chocolate',
'wcfg':{'entries':entries},
'gridcfg':{'sticky':'w'}
})
descr.append({'name':'radioselect2',
'widgetType':Pmw.RadioSelect,
'parent':'Page2',
'listtext':['rb1', 'rb2', 'rb3','rb4', 'rb5', 'rb6',
'rb7', 'rb8', 'rb9','rb10', 'rb11', 'rb12'],
'wcfg':{'labelpos':'n',
'label_text':'Radiobuttons: ',
'orient':'horizontal',
'buttontype':'radiobutton'},
'gridcfg':{'sticky':'w'} })
descr.append({'name':'radioselect',
'widgetType':Pmw.RadioSelect,
'parent':'Page3',
'defaultValue':'rb5',
'listtext':['rb1', 'rb2', 'rb3','rb4', 'rb5', 'rb6',
'rb7', 'rb8', 'rb9','rb10', 'rb11', 'rb12'],
'wcfg':{'labelpos':'n',
'label_text':'Radiobuttons: ',
'orient':'vertical',
'buttontype':'radiobutton'},
'gridcfg':{'sticky':'w'} })
form = InputForm(master, root, descr, modal=0, blocking=0)
values = form.testForm(container='Page3')
assert values['radioselect']=='rb5'
form.destroy()
示例12: doit
# 需要导入模块: from mglutil.gui.InputForm.Tk.gui import InputFormDescr [as 别名]
# 或者: from mglutil.gui.InputForm.Tk.gui.InputFormDescr import append [as 别名]
def doit(self, trajFile, ask=True):
"""creates a Trajectory object, uses its parser to read the trajectory file,
adds created Trajectory object to self.vf.Trajectories dictionary"""
name = os.path.split(trajFile)[1]
trajnames = self.vf.Trajectories.keys()
if name in trajnames:
if ask:
from mglutil.gui.InputForm.Tk.gui import InputFormDescr
ifd = InputFormDescr(title = '')
ifd.append({'widgetType':Pmw.EntryField,
'name':'newtraj',
'required':1,
'wcfg':{'labelpos':'w',
'label_text': "Trajectory %s exists.\nEnter new name:"%(name,),
'validate':None},
'gridcfg':{'sticky':'we'}
})
vals = self.vf.getUserInput(ifd)
if len(vals)>0:
assert not vals['newtraj'] in trajnames
name = vals['newtraj']
else:
return None
else:
name = name+str(len(trajnames))
trj = Trajectory(trajFile)
if trj.parser:
trj.readTrajectory()
self.vf.Trajectories[name] = trj
if self.vf.commands.has_key("playTrajectory"):
if self.vf.playTrajectory.ifd:
cb = self.vf.playTrajectory.ifd.entryByName['trs']['widget']
sl = cb.component('scrolledlist')
trajnames = self.vf.Trajectories.keys()
sl.setlist(trajnames)
cb.selectitem(name)
return name
else: return None
示例13: test_scrolledText
# 需要导入模块: from mglutil.gui.InputForm.Tk.gui import InputFormDescr [as 别名]
# 或者: from mglutil.gui.InputForm.Tk.gui.InputFormDescr import append [as 别名]
def test_scrolledText():
descr = InputFormDescr(title = "Testing ScrolledText")
descr.append({'widgetType':Pmw.ScrolledText,
'name':'sText',
'defaultValue':"""DEFAULT TEXT""",
'wcfg':{'labelpos':'n',
'label_text':'ScrolledText with headers',
'usehullsize': 1,
'hull_width': 400,
'hull_height': 300,
'text_wrap':'none',
'text_padx': 4,
'text_pady': 4,
},
'gridcfg':{'sticky':'wens'}})
form = InputForm(master, root, descr, modal=0, blocking=0)
values = form.testForm()
if not values['sText'] == 'DEFAULT TEXT\n':
raise RuntimeError
form.destroy()
示例14: guiCallback
# 需要导入模块: from mglutil.gui.InputForm.Tk.gui import InputFormDescr [as 别名]
# 或者: from mglutil.gui.InputForm.Tk.gui.InputFormDescr import append [as 别名]
def guiCallback(self):
ifd=InputFormDescr(title='Show/Hide VFGUI components ')
for name in ['infoBar', 'MESSAGE_BOX']:
w = self.getWidget(name)
var = Tkinter.IntVar()
self.tkvarDict[name] = var
cb = CallBackFunction( self.callback, name, var)
ifd.append({'widgetType':Tkinter.Checkbutton,
'name':name,
'wcfg':{'text':name, 'command': cb, 'variable':var,},
'defaultValue': w.winfo_ismapped(),
'gridcfg':{'sticky':Tkinter.W}})
posy = 0
for name in self.vf.GUI.menuBars.keys():
w = self.getWidget(name)
var = Tkinter.IntVar()
self.tkvarDict[name] = var
cb = CallBackFunction( self.callback, name, var)
ifd.append({'widgetType':Tkinter.Checkbutton,
'name':name,
'wcfg':{'text':name, 'command': cb, 'variable':var,},
'defaultValue':w.winfo_ismapped(),
'gridcfg':{'sticky':Tkinter.W,'column':1,'row':posy}})
posy=posy+1
ifd.append({'widgetType':Tkinter.Button,
'name':'dismiss',
'wcfg':{'text':'dismiss', 'command':self.dismiss_cb},
'gridcfg':{'columnspan':2},
})
self.ifd = ifd
val=self.vf.getUserInput(ifd, modal=0)
示例15: buildFormDescr
# 需要导入模块: from mglutil.gui.InputForm.Tk.gui import InputFormDescr [as 别名]
# 或者: from mglutil.gui.InputForm.Tk.gui.InputFormDescr import append [as 别名]
def buildFormDescr(self, formName):
if formName=='chooseCitation':
idf = InputFormDescr(title="Choose Package")
pname = self.citations.keys()
#pname.sort()
idf.append({'name':'packList',
'widgetType':Pmw.ScrolledListBox,
'wcfg':{'items':pname,
'listbox_exportselection':0,
'labelpos':'nw','usehullsize': 1,
'hull_width':100,'hull_height':150,
'listbox_height':5,
'listbox_width':150,
'label_text':'Select a package:',
'selectioncommand':self.displayCitation_cb,
},
'gridcfg':{'sticky':'wesn'}})
idf.append({'name':'citation',
'widgetType':Pmw.ScrolledText,
'wcfg':{'labelpos':'nw',
'text_width':60,
'text_height':10},
'gridcfg':{'sticky':'wens'}
})
idf.append({'name':'dismiss',
'widgetType':Tkinter.Button,
'wcfg':{'text':'DISMISS','command':self.dismiss_cb,
},
'gridcfg':{'sticky':'wens'}})
return idf