本文整理汇总了Python中gtk.HBox类的典型用法代码示例。如果您正苦于以下问题:Python HBox类的具体用法?Python HBox怎么用?Python HBox使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了HBox类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
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()
示例2: password_dialog
class password_dialog(Dialog):
def __init__(self, parent, icon):
Dialog.__init__(self, "GtkPacman Login", parent,
DIALOG_MODAL | DIALOG_DESTROY_WITH_PARENT,
(STOCK_OK, RESPONSE_ACCEPT, STOCK_CANCEL, RESPONSE_REJECT))
self.set_icon(pixbuf_new_from_file(icon))
self._setup_layout()
def _setup_layout(self):
self.password_entry = Entry()
self.password_entry.set_visibility(False)
self.password_entry.set_invisible_char('*')
info_label = Label(' Enter root password ')
self.hbox = HBox()
self.vbox.pack_start(info_label)
self.vbox.pack_start(self.password_entry)
self.vbox.pack_start(self.hbox)
self.show_all()
def show_warning(self):
image = Image()
image.set_from_stock(STOCK_STOP, ICON_SIZE_BUTTON)
warning_label = Label(' Invalid Password! ')
self.hbox.pack_start(image, False, False, 10)
self.hbox.pack_start(warning_label, False, False, 0)
self.show_all()
示例3: __init__
def __init__(self):
HBox.__init__(self)
self.set_spacing(3)
#hour spin
self.__hour_spin = SpinButton()
self.__hour_spin.set_range(00, 99)
self.__hour_spin.set_width_chars(2)
self.__hour_spin.set_increments(1, 1)
self.__hour_spin.set_numeric(True)
self.__hour_spin.set_update_policy(UPDATE_IF_VALID)
self.__hour_spin.set_snap_to_ticks(True)
self.__hour_spin.connect("output", self._on_spin_output)
self.__hour_spin_handler = (self.__hour_spin.connect("value-changed",
self.hour_spin_changed))
self.pack_start(self.__hour_spin)
self.__hour_spin.show()
#separator
sep = Label(":")
self.pack_start(sep, expand=False)
sep.show()
#minute spin
self.__minute_spin = SpinButton()
self.__minute_spin.set_range(00, 59)
self.__minute_spin.set_width_chars(2)
self.__minute_spin.set_increments(1, 1)
self.__minute_spin.set_numeric(True)
self.__minute_spin.set_wrap(True)
self.__minute_spin.set_update_policy(UPDATE_IF_VALID)
self.__minute_spin.set_snap_to_ticks(True)
self.__minute_spin.connect("output", self._on_spin_output)
self.__minute_spin.connect("wrapped", self._on_minute_wrap)
self.__minute_spin_handler = (self.__minute_spin.connect("value-changed",
self.minute_spin_changed))
self.pack_start(self.__minute_spin)
self.__minute_spin.show()
#separator
self.__second_sep = Label(":")
self.pack_start(self.__second_sep, expand=False)
self.__second_sep.show()
#seconds spin
self.__second_spin = SpinButton()
self.__second_spin.set_range(00, 59)
self.__second_spin.set_width_chars(2)
self.__second_spin.set_increments(1, 1)
self.__second_spin.set_numeric(True)
self.__second_spin.set_wrap(True)
self.__second_spin.set_update_policy(UPDATE_IF_VALID)
self.__second_spin.set_snap_to_ticks(True)
self.__second_spin.connect("output", self._on_spin_output)
self.__second_spin.connect("wrapped", self._on_second_wrap)
self.__second_spin_handler = (self.__second_spin.connect("value-changed",
self.second_spin_changed))
self.pack_start(self.__second_spin)
self.__second_spin.show()
示例4: create_encoding_box
def create_encoding_box(combobox):
from i18n import msg0157
from gtk import Label, HBox
label = Label(msg0157)
label.set_use_underline(True)
hbox = HBox(homogeneous=False, spacing=10)
hbox.pack_start(label, False, False, 0)
hbox.pack_start(combobox, True, True, 0)
return hbox
示例5: __init__
def __init__(self, item, name='ItemButton'):
HBox.__init__(self)
self.set_name(name)
self._key_, self._val_ = item
self.label = Label(self._key_)
self.button = Button(label=self._val_)
self.pack_start(self.label,0,0,0)
self.pack_end(self.button,1,1,5)
map(lambda x: x.show(), [self.label, self.button])
self.show()
示例6: __init__
def __init__(self, name='UDBar'):
HBox.__init__(self)
self.set_name(name)
self.ubutton = Button('update')
self.dbutton = Button('diff')
self.pack_start(self.ubutton, 0, 0, 0)
self.pack_end(self.dbutton, 0, 0, 0)
self.ubutton.show()
self.dbutton.show()
self.show()
示例7: __init__
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()
示例8: __init__
def __init__(self):
HBox.__init__(self)
MDSplusWidget.__init__(self)
HBox.set_homogeneous(self,False)
self.node_state=CheckButton('')
self.button=Button()
HBox.pack_start(self,self.node_state,False,False,0)
HBox.pack_start(self,self.button,False,False,0)
HBox.pack_start(self,Label(''),True,False,0)
if not guibuilder:
self.button.connect("clicked",self.popupXd)
self.button.connect("realize",self.setButtonLabel)
示例9: __init__
def __init__(self, queue):
HBox.__init__(self)
self.thread = DlWorker(queue, self.progress, self.set_url)
self.label = Label("hello")
self.pbar = ProgressBar()
self.pack_start(self.label, FALSE, FALSE, 0)
self.pack_end(self.pbar, FALSE, FALSE, 0)
self.label.show()
self.pbar.show()
self.show()
self._done = False
self._started = False
示例10: __init__
def __init__(self, name, default=None):
HBox.__init__(self)
self.set_name(name)
self.label = Label(name)
self.entry = Entry()
self.pack_start(self.label, True, True, 0)
self.add(self.entry)
self.label.show()
self.entry.show()
if default:
self.set(default)
self.show()
示例11: create_button
def create_button(stock_id, string):
from gtk import HBox, Image, Label, ICON_SIZE_BUTTON, Alignment
alignment = Alignment()
alignment.set_property("xalign", 0.5)
alignment.set_property("yalign", 0.5)
hbox = HBox(False, 3)
if stock_id:
image = Image()
image.set_from_stock(stock_id, ICON_SIZE_BUTTON)
hbox.pack_start(image, False, False, 0)
label = Label(string)
label.set_property("use-underline", True)
hbox.pack_start(label, False, False, 0)
alignment.add(hbox)
return alignment
示例12: __init_attributes
def __init_attributes(self, manager, editor):
self.__manager = manager
self.__editor = editor
self.__label = self.__get_label()
self.__button = self.__get_button()
self.__bar = self.__get_bar()
from gtk import HBox, Image
self.__box = HBox(False, 5)
self.__image = Image()
self.__view = editor.textview
return
示例13: quiz
def quiz(self, widget=None):
"""Quiz the user on a random subset of the playlist."""
subset = sample(self.playlist, self.num_songs)
clipStarts = [randrange(0, int(_length(i)) - _clip_length, 1)
for i in subset]
log.debug("Clip starts: %s" % clipStarts)
self.answers = [{'artist': _artist(i), 'title': _title(i),
'genre': _genre(i), 'year': _year(i)} for i in subset]
artist_pool = set(_artist(i) for i in subset)
title_pool = set(_title(i) for i in subset)
date_pool = set(_year(i) for i in subset)
genre_pool = set(_genre(i) for i in subset)
self.responses = []
# Set up quiz_vbox. Remove old children if they're lying around.
for child in self.quiz_vbox.get_children():
self.quiz_vbox.remove(child)
for i in xrange(self.num_songs):
widget = HBox();
artist_cb = combo_box_new_text()
for artist in artist_pool:
artist_cb.append_text(artist)
title_cb = combo_box_new_text()
for title in title_pool:
title_cb.append_text(title)
date_cb = combo_box_new_text()
for date in date_pool:
date_cb.append_text(date)
genre_cb = combo_box_new_text()
for genre in genre_pool:
genre_cb.append_text(genre)
widget.pack_start(artist_cb)
widget.pack_start(title_cb)
widget.pack_start(date_cb)
widget.pack_start(genre_cb)
self.quiz_vbox.pack_start(widget)
self.quiz_vbox.show_all()
self.notebook.next_page()
# Look into doing follow-up code (running the quiz) with a callback
# registered to the notebook's "switch-page" signal.
# Prepare quiz to run in a separate thread.
self.thread = Thread(target=self.play_subset,
kwargs={'subset':subset, 'clipStarts':clipStarts})
self.thread.start()
示例14: _setup_layout
def _setup_layout(self):
self.password_entry = Entry()
self.password_entry.set_visibility(False)
self.password_entry.set_invisible_char('*')
info_label = Label(' Enter root password ')
self.hbox = HBox()
self.vbox.pack_start(info_label)
self.vbox.pack_start(self.password_entry)
self.vbox.pack_start(self.hbox)
self.show_all()
示例15: create_menuitem
def create_menuitem(string, stock_id=None):
from gtk import MenuItem, Image, HBox, Label
hbox = HBox(spacing=7)
hbox.set_property("border-width", 2)
if stock_id:
image = Image()
image.set_property("stock", stock_id)
hbox.pack_start(image, False, False, 0)
label = Label(string)
label.set_property("use-underline", True)
hbox.pack_start(label, False, False, 0)
menuitem = MenuItem()
menuitem.add(hbox)
return menuitem