PyGobject(五十三)布局容器之Table
2016-07-30 13:39
429 查看
GtkTable
继承关系
Methods
Virtual Methods
Properties
Signals
例子
![](https://oscdn.geek-share.com/Uploads/Images/Content/202010/31/c4e6c01fd39f36f37555786d20fcf5bc)
![](https://oscdn.geek-share.com/Uploads/Images/Content/202010/31/1421d2e66ce6697041111d8fd612bf6b)
代码:
代码解析
例子同Gtk.Grid中的例子
比较简单,略过
代码下载地址:http://download.csdn.net/detail/a87b01c14/9594728
继承关系
Methods
Virtual Methods
Properties
Signals
例子
Gtk.Table
Gtk.Table表格布局。Gtk.Table已被弃用,使用Gtk.Grid代替。因为Gtk.Table创建时需要指定列数和行数,而Gtk.Grid不用,它可以动态调整继承关系
Gtk.Table是Gtk.Container的直接子类Methods
方法修饰词 | 方法名及参数 |
---|---|
static | new (rows, columns, homogeneous) |
attach (child, left_attach, right_attach, top_attach, bottom_attach, xoptions, yoptions, xpadding, ypadding) | |
attach_defaults (widget, left_attach, right_attach, top_attach, bottom_attach) | |
get_col_spacing (column) | |
get_default_col_spacing () | |
get_default_row_spacing () | |
get_homogeneous () | |
get_row_spacing (row) | |
get_size () | |
resize (rows, columns) | |
set_col_spacing (column, spacing) | |
set_col_spacings (spacing) | |
set_homogeneous (homogeneous) | |
set_row_spacing (row, spacing) | |
set_row_spacings (spacing) |
Virtual Methods
Properties
Name | Type | Flags | Short Description |
---|---|---|---|
column-spacing | int | r/w | The amount of space between two consecutive columns |
homogeneous | bool | r/w | If True, the table cells are all the same width/height |
n-columns | int | r/w | The number of columns in the table |
n-rows | int | r/w | The number of rows in the table |
row-spacing | int | r/w | The amount of space between two consecutive rows |
Signals
Name | Short Description |
---|
例子
代码:
#!/usr/bin/env python3 # Created by xiaosanyu at 16/6/16 # section 070 TITLE = "Table" DESCRIPTION = """ The Gtk.Table functions allow the programmer to arrange widgets in rows and columns, making it easy to align many widgets next to each other, horizontally and vertically. """ import gi gi.require_version('Gtk', '3.0') from gi.repository import Gtk class TableWindow(Gtk.Window): def __init__(self): Gtk.Window.__init__(self, title="Table Example") table = Gtk.Table(3, 3, True) self.add(table) button1 = Gtk.Button(label="Button 1") button2 = Gtk.Button(label="Button 2") button3 = Gtk.Button(label="Button 3") button4 = Gtk.Button(label="Button 4") button5 = Gtk.Button(label="Button 5") button6 = Gtk.Button(label="Button 6") table.attach(button1, 0, 1, 0, 1) table.attach(button2, 1, 3, 0, 1) table.attach(button3, 0, 1, 1, 3) table.attach(button4, 1, 3, 1, 2) table.attach(button5, 1, 2, 2, 3) table.attach(button6, 2, 3, 2, 3) def main(): win = TableWindow() win.connect("delete-event", Gtk.main_quit) win.show_all() Gtk.main() if __name__ == "__main__": main()
代码解析
例子同Gtk.Grid中的例子
比较简单,略过
代码下载地址: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 七步捉虫法