本文整理汇总了Python中gtk.VBox.show方法的典型用法代码示例。如果您正苦于以下问题:Python VBox.show方法的具体用法?Python VBox.show怎么用?Python VBox.show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gtk.VBox
的用法示例。
在下文中一共展示了VBox.show方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ScrolledFieldBox
# 需要导入模块: from gtk import VBox [as 别名]
# 或者: from gtk.VBox import show [as 别名]
class ScrolledFieldBox(ScrolledWindow):
def __init__(self, all_fields, select_fun, name='ScrolledFieldBox'):
ScrolledWindow.__init__(self)
self.set_name(name)
self.vbox = VBox()
self.vbox.show()
self.add_with_viewport(self.vbox)
示例2: command_dialog
# 需要导入模块: from gtk import VBox [as 别名]
# 或者: from gtk.VBox import show [as 别名]
class command_dialog(Window):
def __init__(self, icon):
Window.__init__(self, WINDOW_TOPLEVEL)
self.set_property("skip-taskbar-hint", True)
self.set_property("destroy-with-parent", True)
self.set_modal(True)
self.set_position(WIN_POS_CENTER)
self.vbox = VBox(False, 0)
self.terminal = terminal()
self.terminal.connect("child-exited",
lambda _: self.close_button.show())
self.terminal.show()
self.close_button = Button(stock=STOCK_CLOSE)
self.close_button.connect("clicked", lambda _: self.destroy())
self.vbox.pack_start(self.terminal, False, False, 0)
self.vbox.pack_start(self.close_button, False, False, 0)
self.vbox.show()
self.add(self.vbox)
self.set_icon(pixbuf_new_from_file(icon))
def run(self, command):
self.show()
self.terminal.fork_command()
self.terminal.feed_child("pacman --noconfirm -%s;exit\n" %command)
示例3: MenuWindow
# 需要导入模块: from gtk import VBox [as 别名]
# 或者: from gtk.VBox import show [as 别名]
class MenuWindow(Window, HasMenuDialog):
def __init__(self, name='MenuVBoxWindow'):
Window.__init__(self)
self.set_name(name)
self.vbox = VBox()
self.add(self.vbox)
self.menubar = SimpleMenuBar()
self.vbox.pack_start(self.menubar, False, False, 0)
self.vbox.show()
self.show()
示例4: RecordBox
# 需要导入模块: from gtk import VBox [as 别名]
# 或者: from gtk.VBox import show [as 别名]
class RecordBox(ScrolledWindow, HasRecordBox):
def __init__(self, data, name='RecordBox'):
ScrolledWindow.__init__(self)
self.set_name(name)
self.vbox = VBox()
self.add_with_viewport(self.vbox)
HasRecordBox.__init__(self, self.vbox, data, name=name)
self.vbox.show()
self.show()
self.vbox.set_events(BUTTON_PRESS_MASK)
示例5: TwinListCndWin
# 需要导入模块: from gtk import VBox [as 别名]
# 或者: from gtk.VBox import show [as 别名]
class TwinListCndWin(Window):
def __init__(self):
Window.__init__(self)
self.vbox = VBox()
self.button_box = HBox()
self.listbox = TwinCList()
self.vbox.add(self.listbox)
self.add(self.vbox)
self.vbox.show()
self.show()
self.set_size_request(300, 200)
self.listbox.set_position(140)
示例6: MenuWindowOrig
# 需要导入模块: from gtk import VBox [as 别名]
# 或者: from gtk.VBox import show [as 别名]
class MenuWindowOrig(Window):
def __init__(self, name='MenuVBoxWindow'):
Window.__init__(self)
self.set_name(name)
self.vbox = VBox()
self.add(self.vbox)
self.menubar = SimpleMenuBar()
self.vbox.pack_start(self.menubar, False, False, 0)
self.vbox.show()
self.show()
def add_menu(self, commands, name, function, radio=False):
if radio:
new_menu = RadioMenu(commands, function)
else:
new_menu = SimpleMenu()
for command in commands:
new_menu.add(command, function)
self.menubar.append(new_menu, name)
示例7: upgrade_dialog
# 需要导入模块: from gtk import VBox [as 别名]
# 或者: from gtk.VBox import show [as 别名]
class upgrade_dialog(Window):
def __init__(self, to_upgrade, icon):
Window.__init__(self, WINDOW_TOPLEVEL)
self.set_property("skip-taskbar-hint", True)
self.set_property("modal", True)
self.set_property("destroy-with-parent", True)
self.set_position(WIN_POS_CENTER)
self.set_default_size (300, 300)
self.set_icon(pixbuf_new_from_file(icon))
self._setup_tree(to_upgrade)
self._setup_layout()
def _setup_layout(self):
self.vbox = VBox(False, 0)
self.vbox.show()
self.terminal = terminal()
self.terminal.connect("child-exited", lambda _: self.close_button.show())
self.expander = expander_new_with_mnemonic(_("_Terminal"))
self.expander.set_expanded(False)
self.expander.add(self.terminal)
self.expander.show_all()
self.close_button = Button(stock=STOCK_CLOSE)
self.close_button.connect("clicked", lambda _: self.destroy())
scr = ScrolledWindow()
scr.set_policy ("automatic", "automatic")
scr.add (self.tree)
scr.show()
vpaned = VPaned()
vpaned.add1(scr)
vpaned.add2(self.expander)
vpaned.set_position (260)
vpaned.show()
self.vbox.pack_start(vpaned, True, True, 0)
self.vbox.pack_start(self.close_button, False, False, 0)
self.add(self.vbox)
return
def _setup_tree(self, pacs):
self.model = ListStore(str, str, str)
for pac in pacs:
self.model.append(["yellow", pac.name, pac.version])
continue
self.tree = TreeView()
self.tree.show()
self.tree.insert_column_with_attributes(-1, "", CellRendererPixbuf(),
stock_id = 0)
self.tree.insert_column_with_attributes(-1, "Package",
CellRendererText(), text = 1)
self.tree.insert_column_with_attributes(-1, "Version",
CellRendererText(), text = 2)
self.tree.set_model(self.model)
return
def run(self):
self.show()
self.terminal.do_upgrade()
示例8: do_dialog
# 需要导入模块: from gtk import VBox [as 别名]
# 或者: from gtk.VBox import show [as 别名]
class do_dialog(Window):
def __init__(self, queues, icon):
Window.__init__(self, WINDOW_TOPLEVEL)
self.set_property("skip-taskbar-hint", True)
self.set_property("destroy-with-parent", True)
self.set_modal(True)
self.connect("delete-event", self._stop_closing)
self.set_position(WIN_POS_CENTER)
self.set_icon(pixbuf_new_from_file(icon))
self._setup_trees(queues)
self._setup_layout()
self.queues = queues
def _setup_trees(self, queues):
self._setup_install_tree(queues["add"])
self._setup_remove_tree(queues["remove"])
def _setup_install_tree(self, add_queue):
self.inst_model = ListStore(str, str, str)
for pac in add_queue:
if pac.isold:
image = "yellow"
elif pac.installed:
image = "green"
else:
image = "red"
self.inst_model.append([image, pac.name, pac.version])
continue
self.inst_tree = TreeView()
self.inst_tree.insert_column_with_attributes(-1, "",
CellRendererPixbuf(),
stock_id = 0)
self.inst_tree.insert_column_with_attributes(-1, _("Package"),
CellRendererText(),
text = 1)
self.inst_tree.insert_column_with_attributes(-1, _("Version"),
CellRendererText(),
text = 2)
self.inst_tree.set_model(self.inst_model)
def _setup_remove_tree(self, remove_queue):
self.rem_model = ListStore(str, str, str)
for pac in remove_queue:
if pac.isold:
image = "yellow"
elif pac.installed:
image = "green"
else:
image = "red"
self.rem_model.append([image, pac.name, pac.inst_ver])
continue
self.rem_tree = TreeView()
self.rem_tree.insert_column_with_attributes(-1, "",
CellRendererPixbuf(),
stock_id = 0)
self.rem_tree.insert_column_with_attributes(-1, _("Package"),
CellRendererText(),
text = 1)
self.rem_tree.insert_column_with_attributes(-1, _("Installed Version"),
CellRendererText(),
text = 2)
self.rem_tree.set_model(self.rem_model)
def _set_size (self, widget, event, data=None):
if self.expander.get_expanded():
self.size = self.get_size()
self.expander.add(self.terminal)
self.terminal.show()
else:
self.expander.remove(self.terminal)
self.resize(self.size[0], self.size[1])
self.show_all()
def _setup_layout(self):
self.hpaned = HPaned()
self.hpaned.add1(self.inst_tree)
self.hpaned.add2(self.rem_tree)
self.hpaned.show_all()
self.close_button = Button(stock=STOCK_CLOSE)
self.close_button.connect("clicked", lambda _: self.destroy())
self.terminal = terminal()
#.........这里部分代码省略.........
示例9: Base
# 需要导入模块: from gtk import VBox [as 别名]
# 或者: from gtk.VBox import show [as 别名]
class Base(object):
def __init__(self):
from gtk import Window,WINDOW_TOPLEVEL,Button,Label,HBox,Entry,VBox,VSeparator
self.window = Window(WINDOW_TOPLEVEL)
self.window.set_title("Slideshow")
self.window.connect("delete_event", self.delete_event)
self.window.set_border_width(10)
self.vbox = VBox(False, 0)
self.window.add(self.vbox)
self.hbox1 = HBox(False, 0)
self.vbox.pack_start(self.hbox1, True, True, 1)
self.hbox = HBox(False, 0)
self.vbox.pack_start(self.hbox, False, False, 1)
self.hbox2 = HBox(False, 0)
self.vbox.pack_start(self.hbox2, True, True, 1)
self.label = Label('Identifikační číslo:')
self.hbox.pack_start(self.label, False, False, 1)
self.label.show()
self.editable = Entry()
self.editable.connect('key_press_event', self.key_press_event)
self.hbox.pack_start(self.editable, True, True, 1)
self.editable.show()
self.button = Button("Začít")
self.button.connect("clicked", self.callback)
self.button.set_receives_default(True)
self.button.set_can_focus(True)
self.hbox.pack_start(self.button, False, False, 1)
self.button.show()
self.hbox1.show()
self.hbox.show()
self.hbox2.show()
self.vbox.show()
self.window.show()
def delete_event(self, widget, event, data=None):
gtk.main_quit()
return False
def key_press_event(self, widget, event):
from gtk.gdk import keyval_from_name,keyval_name
if event.keyval in (keyval_from_name('Return'),keyval_from_name('KP_Enter')):
self.callback(widget)
def _getFilePaths(self, fileTypes, recursive=True):
import os
import re
from sys import argv
pt = re.compile(r'.*([%(0)s][^%(0)s]*)'%{'0':os.path.extsep})
path = [a for m,a in ((pt.match(os.path.basename(a)),a) for a in argv[1:]) if m and m.group(1) in fileTypes]
if not path:
path = '/home/pi/img/*.jpg'
if isinstance(path, str):
## Returns list containing paths of files in /path/ that are of a file type in /fileTypes/,
## if /recursive/ is False subdirectories are not checked.
paths = []
if recursive:
for root, folders, files in os.walk(path, followlinks=True):
for file in files:
for fileType in fileTypes:
if file.endswith(fileType):
paths.append(os.path.join(root, file))
else:
for item in os.listdir(path):
for fileType in fileTypes:
if item.endswith(fileType):
paths.append(os.path.join(root, item))
return paths
elif iterable(path):
return path
else:
return []
def _init_cb(self,trans):
from threading import Thread
if not iterable(trans):
trans = trans,
callbacks = []
for name,cb in trans:
t = Thread(target=cb, name='%sThread'%name)
t.daemon = True
t.start()
callbacks.append(cb.enqueue)
def wrap(msg):
for cb in callbacks:
if not cb(msg):
return False
return True
return wrap
def callback(self, widget):
from slideshow import SlideShow
from trans import Message,GpioTransceiver,JsonTransceiver
if not self.editable.get_text():
return False
img_cbs = self._init_cb([('ImgGpioCallback',GpioTransceiver(24)),('ImgJsonCallback',JsonTransceiver('img.json'))])
kp_cbs = self._init_cb([('KpGpioCallback',GpioTransceiver(26,bcd=False)),('KpJsonCallback',JsonTransceiver('kp.json'))])
def ordfnc(path):
from numpy.random import permutation
gray = path[0]
result = []
for p in permutation(path[1:]):
result.append(p)
result.append(gray)
return result
#.........这里部分代码省略.........