PyGobject(十八)布局容器之ActionBar
来源:互联网 发布:太阳能热水器 知乎 编辑:程序博客网 时间:2024/05/21 17:22
- GtkActionBar
- 继承关系
- Methods
- Virtual Methods
- Properties
- Signals
- 例子
Gtk.ActionBar
继承关系
Gtk.ActionBar被设计为呈现上下文动作。
通常水平放置在主要内容的下方
Gtk.ActionBar是Gtk.Bin的直接子类
Methods
Virtual Methods
Properties
Signals
例子
代码:
#!/usr/bin/env python3# Created by xiaosanyu at 16/7/7# section 019TITLE = "ActionBar"DESCRIPTION = """Gtk.ActionBar is designed to present contextual actions.It is expected to be displayed below the content and expand horizontally to fill the area"""import gigi.require_version("Gtk", "3.0")from gi.repository import Gtkicons = ["edit-cut", "edit-paste", "edit-copy"]class ActionBarWindow(Gtk.Window): def __init__(self): Gtk.Window.__init__(self, title="ActionBar Example") self.set_size_request(250, 200) box = Gtk.VBox() ab = Gtk.ActionBar() theme = Gtk.IconTheme.get_default() for i, icon in enumerate(icons): if theme.has_icon(icon): image = Gtk.Image.new_from_icon_name(icon, Gtk.IconSize.MENU) button = Gtk.Button() button.add(image) if i == 0: ab.pack_start(button) elif i == 1: ab.set_center_widget(button) elif i == 2: ab.pack_end(button) box.pack_end(ab, False, False, 0) box.pack_start(Gtk.TextView(), True, True, 0) self.add(box)def main(): win = ActionBarWindow() win.connect("delete-event", Gtk.main_quit) win.show_all() Gtk.main()if __name__ == "__main__": main()
分析主要代码
创建Gtk.ActionBar
ab = Gtk.ActionBar()
创建三个图片按钮,第一个放在最左边,第二个放在中间,第三个放在最末尾
icons = ["edit-cut", "edit-paste", "edit-copy"]theme = Gtk.IconTheme.get_default()for i, icon in enumerate(icons): if theme.has_icon(icon): image = Gtk.Image.new_from_icon_name(icon, Gtk.IconSize.MENU) button = Gtk.Button() button.add(image) if i == 0: ab.pack_start(button) elif i == 1: ab.set_center_widget(button) elif i == 2: ab.pack_end(button)
代码下载地址:http://download.csdn.net/detail/a87b01c14/9594728
0 0
- PyGobject(十八)布局容器之ActionBar
- PyGobject(二十八)布局容器之Revealer
- PyGobject(十九)布局容器之Alignment
- PyGobject(三十)布局容器之StackSidebar
- PyGobject(三十一)布局容器之EventBox
- PyGobject(三十二)布局容器之Window
- PyGobject(三十三)布局容器之ApplicationWindow
- PyGobject(三十四)布局容器之Assistant
- PyGobject(三十五)布局容器之ShortcutsWindow
- PyGobject(三十六)布局容器之OffscreenWindow
- PyGobject(三十七)布局容器之Dialog
- PyGobject(三十八)布局容器之ScrolledWindow
- PyGobject(三十九)布局容器之PlacesSidebar
- PyGobject(四十)布局容器之Viewport
- PyGobject(四十一)布局容器之Box
- PyGobject(四十二)布局容器之ButtonBox
- PyGobject(四十五)布局容器之Grid
- PyGobject(四十六)布局容器之Fixed
- Android 群发短信的实现
- 国内一线互联网公司内部面试题库
- html头文件设置常用之<meta>设置缓存
- Mockito:一个强大的用于 Java 开发的模拟测试框架
- Android解决SurfaceView预览Camera拉伸问题
- PyGobject(十八)布局容器之ActionBar
- Android--数据库的增删改查之数据库的增加
- Android网络请求的架构之路
- 关于ListView的小知识
- 源码-PL/SQL从入门到精通-第十六章-动态SQL语句-Part 2
- 训练之线段树I Hate It
- jdbc.properties 文件的配置
- 关于editext笔记
- 玩转HTML5移动页面——动效篇