欧美三区_成人在线免费观看视频_欧美极品少妇xxxxⅹ免费视频_a级毛片免费播放_鲁一鲁中文字幕久久_亚洲一级特黄

pygtk-浮動控件,工具條

系統 2410 0

Handle Box這容器跟上一篇博文中所介紹到Exapnder一樣,,只允許有一個子控件在上面。Handle Box是一個可以拿下來到控件,可以浮動到控件。咦,這功能好熟悉哦,呵呵,你想得不錯,在windows中,窗口的工具欄里面的元素是可以用鼠標拖動的。Handle Box控件能用來制作一些浮動菜單。

toolbox就是工具條

toolbar.append_item(text, tooltip_text, tooltip_private_text, icon,callback, user_data=None)
toolbar.prepend_item(text, tooltip_text, tooltip_private_text, icon,callback, user_data)

toolbar.insert_item(text, tooltip_text, tooltip_private_text, icon, callback,user_data, position)?

toolbar.append_space()
toolbar.prepend_space()
toolbar.insert_space(position)

?

toolbar.set_orientation(orientation)

orientation :ORIENTATION_HORIZONTAL or ORIENTATION_VERTICAL


toolbar.set_style(style)

style:TOOLBAR_ICONS, TOOLBAR_TEXT, TOOLBAR_BOTH

?

toolbar.set_tooltips(enable)

?

?

?

    #!/usr/bin/env python

# example toolbar.py

import pygtk
pygtk.require('2.0')
import gtk

class ToolbarExample:
    # This method is connected to the Close button or
    # closing the window from the WM
    def delete_event(self, widget, event=None):
        gtk.main_quit()
        return False
     # that’s easy... when one of the buttons is toggled, we just
     # check which one is active and set the style of the toolbar
     # accordingly
    def radio_event(self, widget, toolbar):
        if self.text_button.get_active():
            toolbar.set_style(gtk.TOOLBAR_TEXT)
        elif self.icon_button.get_active():
            toolbar.set_style(gtk.TOOLBAR_ICONS)
        elif self.both_button.get_active():
            toolbar.set_style(gtk.TOOLBAR_BOTH)


 # even easier, just check given toggle button and enable/disable
 # tooltips
    def toggle_event(self, widget, toolbar):
        toolbar.set_tooltips(widget.get_active())
        
    def __init__(self):
        # Here is our main window (a dialog) and a handle for the handlebox
        # Ok, we need a toolbar, an icon with a mask (one for all of
        # the buttons) and an icon widget to put this icon in (but
        # we’ll create a separate widget for each button)
        # create a new window with a given title, and nice size
        dialog = gtk.Dialog()
        dialog.set_title("GTKToolbar Tutorial")
        dialog.set_size_request(450, 250)
        dialog.set_resizable(True)
        
        # typically we quit if someone tries to close us
        dialog.connect("delete_event", self.delete_event)
        
        # to make it nice we’ll put the toolbar into the handle box,
        # so that it can be detached from the main window
        handlebox = gtk.HandleBox()
        dialog.vbox.pack_start(handlebox, False, False, 5)
        # toolbar will be horizontal, with both icons and text, and
        # with 5pxl spaces between items and finally,
        # we’ll also put it into our handlebox
        toolbar = gtk.Toolbar()
        toolbar.set_orientation(gtk.ORIENTATION_HORIZONTAL)
        toolbar.set_style(gtk.TOOLBAR_BOTH)
        toolbar.set_border_width(5)
        handlebox.add(toolbar)
        
        # our first item is <close> button
        iconw = gtk.Image() # icon widget
        iconw.set_from_file("about.xpm")
        close_button = toolbar.append_item(
        "Close", # button label
        "Closes this app", # this button’s tooltip  
         "Private", # tooltip private info
        iconw, # icon widget
        self.delete_event) # a signal
        toolbar.append_space() # space after item   
        # now, let’s make our radio buttons group...
        
        iconw = gtk.Image() # icon widget
        iconw.set_from_file("about.xpm")
        icon_button = toolbar.append_element(
        gtk.TOOLBAR_CHILD_RADIOBUTTON, # type of element
        None, # widget
        "Icon", # label
        "Only icons in toolbar", # tooltip
        "Private", # tooltip private string
        iconw, # icon
        self.radio_event, # signal
        toolbar) # data for signal
        toolbar.append_space()
        self.icon_button = icon_button  
        # following radio buttons refer to previous ones
        iconw = gtk.Image() # icon widget
        iconw.set_from_file("about.xpm")
        text_button = toolbar.append_element(
        gtk.TOOLBAR_CHILD_RADIOBUTTON,
        icon_button,
        "Text",
        "Only texts in toolbar",
        "Private",
        iconw,
        self.radio_event,
        toolbar)
        toolbar.append_space()
        self.text_button = text_button
        iconw = gtk.Image() # icon widget
        iconw.set_from_file("about.xpm")
        both_button = toolbar.append_element(
        gtk.TOOLBAR_CHILD_RADIOBUTTON,
        text_button,
        "Both",
        "Icons and text in toolbar",
        "Private",
        iconw,
        self.radio_event,
        toolbar)
        toolbar.append_space()
        self.both_button = both_button
        both_button.set_active(True)    
        # here we have just a simple toggle button
        iconw = gtk.Image() # icon widget
        iconw.set_from_file("about.xpm")
        tooltips_button = toolbar.append_element(
        gtk.TOOLBAR_CHILD_TOGGLEBUTTON,
        None,
        "Tooltips",
        "Toolbar with or without tips",
        "Private",
        iconw,
        self.toggle_event,
        toolbar)
        toolbar.append_space()
        tooltips_button.set_active(True)    
        # to pack a widget into toolbar, we only have to
        # create it and append it with an appropriate tooltip
        entry = gtk.Entry()
        toolbar.append_widget(entry, "This is just an entry", "Private")
        # well, it isn’t created within the toolbar, so we must still show it
        entry.show()    
        # that’s it ! let’s show everything.
        toolbar.show()
        handlebox.show()
        dialog.show()
def main():
        # rest in gtk_main and wait for the fun to begin!
    gtk.main()
    return 0
if __name__ == "__main__":
    ToolbarExample()
    main()

  

?

?
pygtk-浮動控件,工具條
?

pygtk-浮動控件,工具條


更多文章、技術交流、商務合作、聯系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 九九综合视频 | 九九热观看视频 | 国产免费av大片 | 国产自产视频 | 久久91精品国产91久久小草 | 国产精品二区三区 | 艹逼免费视频 | 窝窝午夜精品一区二区 | 国产精品美女久久久久久 | 夜夜视频 | 亚洲色婷婷久久精品AV蜜桃久久 | 99热.com| 三上悠亚2022最新新作番号 | 三级视频网站 | 久色一区 | 天堂2014| 国产一区二区欧美 | 99国产精品 | 亚洲九九| 狠狠色丁香婷婷综合橹不卡 | 亚洲精品午夜视频 | 日本熟妇无码波多野1223 | 91精品天美精东蜜桃传媒免费 | 国产精品视频999 | 亚洲综合久久久久久中文字幕 | 狠狠操天天操夜夜操 | 亚洲精品黄色 | 91视频观看 | 亚洲国产精品第一区二区三区 | 国产精品国产成人国产三级 | 国产伦精品一区二区三区精品视频 | 日韩在线无 | www.奇米第四色 | 精品视频在线观看 | 国产乳摇福利视频在线观看 | 日本免费观看官网 | 亚洲欧美日韩在线一区二区三区 | 美女午夜色视频在线观看 | 亚欧美| 一区二区日韩 | 99久久婷婷|