PyGobject(十八)布局容器之ActionBar
2016-07-26 16:21
489 查看
GtkActionBar
继承关系
Methods
Virtual Methods
Properties
Signals
例子
通常水平放置在主要内容的下方
Gtk.ActionBar是Gtk.Bin的直接子类
代码:
分析主要代码
创建Gtk.ActionBar
创建三个图片按钮,第一个放在最左边,第二个放在中间,第三个放在最末尾
代码下载地址:http://download.csdn.net/detail/a87b01c14/9594728
继承关系
Methods
Virtual Methods
Properties
Signals
例子
Gtk.ActionBar
继承关系
Gtk.ActionBar被设计为呈现上下文动作。通常水平放置在主要内容的下方
Gtk.ActionBar是Gtk.Bin的直接子类
Methods
方法修饰词 | 方法名及参数 |
---|---|
static | new () |
get_center_widget () | |
pack_end (child) | |
pack_start (child) | |
set_center_widget (center_widget) |
Virtual Methods
Properties
Name | Type | Flags | Short Description |
---|
Signals
Name | Short Description |
---|
例子
代码:
#!/usr/bin/env python3 # Created by xiaosanyu at 16/7/7 # section 019 TITLE = "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 gi gi.require_version("Gtk", "3.0") from gi.repository import Gtk icons = ["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
相关文章推荐
- Python动态类型的学习---引用的理解
- Python3写爬虫(四)多线程实现数据爬取
- 垃圾邮件过滤器 python简单实现
- 下载并遍历 names.txt 文件,输出长度最长的回文人名。
- install and upgrade scrapy
- Scrapy的架构介绍
- Centos6 编译安装Python
- 使用Python生成Excel格式的图片
- 让Python文件也可以当bat文件运行
- [Python]推算数独
- Python中zip()函数用法举例
- Python中map()函数浅析
- Python将excel导入到mysql中
- Python在CAM软件Genesis2000中的应用
- 使用Shiboken为C++和Qt库创建Python绑定
- FREEBASIC 编译可被python调用的dll函数示例
- Python 七步捉虫法