本文整理汇总了Python中gtk.ScrolledWindow.add_with_viewport方法的典型用法代码示例。如果您正苦于以下问题:Python ScrolledWindow.add_with_viewport方法的具体用法?Python ScrolledWindow.add_with_viewport怎么用?Python ScrolledWindow.add_with_viewport使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gtk.ScrolledWindow
的用法示例。
在下文中一共展示了ScrolledWindow.add_with_viewport方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _ScrollBox
# 需要导入模块: from gtk import ScrolledWindow [as 别名]
# 或者: from gtk.ScrolledWindow import add_with_viewport [as 别名]
class _ScrollBox(Dialog):
def __init__(self, message, name='MyScrollBox', type='v'):
Dialog.__init__(self, message, name=name)
self.scroll = ScrolledWindow()
self.scroll.show()
self.vbox.pack_start(self.scroll, TRUE, TRUE, 0)
self.set_size_request(150, 300)
if type =='v':
self.mbox = VBox()
else:
self.mbox = HBox()
self.scroll.add_with_viewport(self.mbox)
self.mbox.show()
示例2: MDSplusMethodWidget
# 需要导入模块: from gtk import ScrolledWindow [as 别名]
# 或者: from gtk.ScrolledWindow import add_with_viewport [as 别名]
class MDSplusMethodWidget(Table):
def __init__(self,value=None):
super(MDSplusMethodWidget,self).__init__(rows=4,columns=2,homogeneous=False)
self.device=Entry()
self.method=Entry()
self.args=list()
self.argTable=Table(rows=8,columns=2,homogeneous=False)
for i in range(8):
self.args.append(Entry())
self.argTable.attach(Label("Arg %d: " % (i+1,)),0,1,i,i+1,0,0)
self.argTable.attach(self.args[i],1,2,i,i+1,EXPAND|FILL,0)
self.scrolledWindow=ScrolledWindow()
self.scrolledWindow.add_with_viewport(self.argTable)
self.scrolledWindow.set_policy(POLICY_NEVER,POLICY_ALWAYS)
adj=self.scrolledWindow.get_vadjustment()
adj.connect("changed",adj_changed)
self.timeout=Entry()
self.attach(Label("Device:"),0,1,0,1,0,0)
self.attach(self.device,1,2,0,1,EXPAND|FILL,0)
self.attach(Label("Method:"),0,1,1,2,0,0)
self.attach(self.method,1,2,1,2,EXPAND|FILL,0)
self.attach(self.scrolledWindow,0,2,2,3)
self.attach(Label("Timeout:"),0,1,3,4,0,0)
self.attach(self.timeout,1,2,3,4,EXPAND|FILL,0)
self.set_row_spacings(5)
self.value=value
def getValue(self):
ans=Method()
ans.method=self.method.get_text()
try:
ans.method=Data.compile(ans.method)
except Exception,e:
pass
try:
ans.object=Data.compile(self.device.get_text())
except Exception,e:
msg="Invalid device specified.\n\n%s" % (e,)
MDSplusErrorMsg('Invalid Device',msg)
raise
示例3: MDSplusRoutineWidget
# 需要导入模块: from gtk import ScrolledWindow [as 别名]
# 或者: from gtk.ScrolledWindow import add_with_viewport [as 别名]
class MDSplusRoutineWidget(Table):
def __init__(self,value=None):
super(MDSplusRoutineWidget,self).__init__(rows=4,columns=2,homogeneous=False)
self.image=Entry()
self.routine=Entry()
self.args=list()
self.argTable=Table(rows=8,columns=2,homogeneous=False)
for i in range(8):
self.args.append(Entry())
self.argTable.attach(Label("Arg %d: " % (i+1,)),0,1,i,i+1,0,0)
self.argTable.attach(self.args[i],1,2,i,i+1,EXPAND|FILL,0)
self.scrolledWindow=ScrolledWindow()
self.scrolledWindow.add_with_viewport(self.argTable)
self.scrolledWindow.set_policy(POLICY_NEVER,POLICY_ALWAYS)
adj=self.scrolledWindow.get_vadjustment()
adj.connect("changed",adj_changed)
self.timeout=Entry()
self.attach(Label("Library:"),0,1,0,1,0,0)
self.attach(self.image,1,2,0,1,EXPAND|FILL,0)
self.attach(Label("Routine:"),0,1,1,2,0,0)
self.attach(self.routine,1,2,1,2,EXPAND|FILL,0)
self.attach(self.scrolledWindow,0,2,2,3)
self.attach(Label("Timeout:"),0,1,3,4,0,0)
self.attach(self.timeout,1,2,3,4,EXPAND|FILL,0)
self.set_row_spacings(5)
self.value=value
def getValue(self):
ans=Routine()
ans.image=self.image.get_text()
try:
ans.image=Data.compile(ans.image)
except Exception,e:
pass
ans.routine=self.routine.get_text()
try:
ans.routine=Data.compile(ans.routine)
except Exception,e:
pass
示例4: MDSplusRoutineWidget
# 需要导入模块: from gtk import ScrolledWindow [as 别名]
# 或者: from gtk.ScrolledWindow import add_with_viewport [as 别名]
class MDSplusRoutineWidget(Table):
def __init__(self,value=None):
super(MDSplusRoutineWidget,self).__init__(rows=4,columns=2,homogeneous=False)
self.image=Entry()
self.routine=Entry()
self.args=list()
self.argTable=Table(rows=8,columns=2,homogeneous=False)
for i in range(8):
self.args.append(Entry())
self.argTable.attach(Label("Arg %d: " % (i+1,)),0,1,i,i+1,0,0)
self.argTable.attach(self.args[i],1,2,i,i+1,EXPAND|FILL,0)
self.scrolledWindow=ScrolledWindow()
self.scrolledWindow.add_with_viewport(self.argTable)
self.scrolledWindow.set_policy(POLICY_NEVER,POLICY_ALWAYS)
adj=self.scrolledWindow.get_vadjustment()
adj.connect("changed",adj_changed)
self.timeout=Entry()
self.attach(Label("Library:"),0,1,0,1,0,0)
self.attach(self.image,1,2,0,1,EXPAND|FILL,0)
self.attach(Label("Routine:"),0,1,1,2,0,0)
self.attach(self.routine,1,2,1,2,EXPAND|FILL,0)
self.attach(self.scrolledWindow,0,2,2,3)
self.attach(Label("Timeout:"),0,1,3,4,0,0)
self.attach(self.timeout,1,2,3,4,EXPAND|FILL,0)
self.set_row_spacings(5)
self.value=value
def getValue(self):
ans=Routine()
ans.image=self.image.get_text()
try:
ans.image=Data.compile(ans.image)
except Exception:
pass
ans.routine=self.routine.get_text()
try:
ans.routine=Data.compile(ans.routine)
except Exception:
pass
if self.timeout.get_text() == '' or self.timeout.get_text() == '*':
ans.timeout=None
else:
try:
ans.timeout=Data.compile(self.timeout.get_text())
except Exception:
msg="Invalid timeout specified.\n\n%s" % (sys.exc_info(),)
MDSplusErrorMsg('Invalid Timeout',msg)
raise
idx=len(self.args)-1
found=False
while idx >= 0:
t = self.args[idx].get_text()
if t == '':
if found:
ans.setArgumentAt(idx,None)
else:
try:
a=Data.compile(t)
except Exception:
msg="Invalid argument specified.\n\n%s" % (sys.exc_info(),)
MDSplusErrorMsg('Invalid Argument',msg)
raise
ans.setArgumentAt(idx,a)
found=True
idx=idx-1
return ans
def setValue(self,d):
self._value=d
self.reset()
def reset(self):
if isinstance(self._value,Routine):
self.image.set_text(self._value.image.decompile())
self.routine.set_text(self._value.routine.decompile())
if self._value.timeout is None or self._value.timeout.decompile() == '*':
self.timeout.set_text('')
else:
self.timeout.set_text(self._value.timeout.decompile())
idx=0
for arg in self.args:
if self._value.getArgumentAt(idx) is None:
arg.set_text('')
else:
arg.set_text(self._value.getArgumentAt(idx).decompile())
idx=idx+1
else:
self.image.set_text('')
self.routine.set_text('')
self.timeout.set_text('')
for arg in self.args:
arg.set_text('')
value=property(getValue,setValue)
def show(self):
old=self.get_no_show_all()
self.set_no_show_all(False)
#.........这里部分代码省略.........