本文整理汇总了Python中gtk.HScale方法的典型用法代码示例。如果您正苦于以下问题:Python gtk.HScale方法的具体用法?Python gtk.HScale怎么用?Python gtk.HScale使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gtk
的用法示例。
在下文中一共展示了gtk.HScale方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import HScale [as 别名]
def __init__(self):
super(app, self).__init__()
self.set_position(gtk.WIN_POS_CENTER)
self.set_title("Edge Threshold Adjuster")
self.set_decorated(True)
self.set_has_frame(False)
self.set_resizable(False)
self.set_default_size(self.window_width,self.window_height)
self.connect("destroy", gtk.main_quit)
vbox = gtk.VBox(spacing=4)
#Setup the slider bar
scale = gtk.HScale()
scale.set_range(self.min_threshold, self.max_threshold)
scale.set_size_request(500, 25)
scale.set_value((self.max_threshold + self.min_threshold) / 2)
scale.connect("value-changed", self.update_threshold)
vbox.add(scale)
#Setup the information label
info = gtk.Label()
info.set_label("Move the slider to adjust the edge detection threshold")
vbox.add(info)
#Add the image to the display
new_image = self.process_image()
converted_image = gtk.gdk.pixbuf_new_from_array(new_image, gtk.gdk.COLORSPACE_RGB, 8)
image = gtk.Image()
image.set_from_pixbuf(converted_image)
image.show()
vbox.add(image)
self.current_image = image
self.add(vbox)
self.show_all()
示例2: __init__
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import HScale [as 别名]
def __init__(self):
super(app, self).__init__()
self.set_position(gtk.WIN_POS_CENTER)
self.set_title("Edge Threshold Adjuster")
self.set_decorated(True)
self.set_has_frame(False)
self.set_resizable(False)
self.set_default_size(self.window_width,self.window_height)
self.connect("destroy", gtk.main_quit)
vbox = gtk.VBox(spacing=4)
#Setup the slider bar
scale = gtk.HScale()
scale.set_range(self.min_threshold, self.max_threshold)
scale.set_size_request(500, 25)
scale.set_value((self.max_threshold + self.min_threshold) / 2)
scale.connect("value-changed", self.update_threshold)
vbox.add(scale)
#Setup the information label
info = gtk.Label()
info.set_label("Move the slider to adjust the edge detection threshold")
vbox.add(info)
#Add the image to the display
new_image = self.process_image()
converted_image = gtk.gdk.pixbuf_new_from_array(new_image, gtk.gdk.COLORSPACE_RGB, 8)
image = gtk.Image()
image.set_from_pixbuf(converted_image)
image.show()
vbox.add(image)
gobject.timeout_add(self.refresh_rate, self.refresh)
self.current_image = image
self.add(vbox)
self.show_all()
示例3: __init__
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import HScale [as 别名]
def __init__(self):
self.main_loop = gobject.MainLoop()
# Create a window with a horizontal scale.
self.wnd = gtk.Window()
self.wnd.set_default_size(640, 480)
self.wnd.set_title('Have fun with the transparency slider')
hscale = gtk.HScale()
hscale.set_digits(0)
hscale.set_increments(1, 10)
hscale.set_range(0, 100)
hscale.set_value(100)
hscale.connect('value_changed', self.set_window_alpha)
self.wnd.add(hscale)
# Note: gtk window must be realized before installing extensions.
self.wnd.realize()
self.wnd.show_all()
self.win32ext = GTKWin32Ext(self.wnd)
self.win32ext.add_notify_icon()
# GTK menus from the notify icon!
menu = gtk.Menu()
menu_item = gtk.MenuItem('Baloons!')
menu_item.connect_object('activate', self.menu_cb, self.wnd)
menu.append(menu_item)
menu_item = gtk.MenuItem('Fadeout Window')
menu_item.connect('activate', self.fadeoutwindow)
menu.append(menu_item)
menu_item = gtk.MenuItem('Window Disappeared?')
menu_item.connect('activate', self.fadeinwindow)
menu.append(menu_item)
menu.show_all()
self.win32ext.notify_icon.menu = menu
# Set up the callback messages
self.win32ext.message_map({
WM_TRAYMESSAGE: self.on_notifyicon_activity
})