Gtk.Arrow
继承关系
Gtk.Arrow上下左右四个箭头
Methods
方法修饰词 | 方法名及参数 |
---|---|
static | new (arrow_type, shadow_type) |
set (arrow_type, shadow_type) |
Virtual Methods
Properties
Name | Type | Flags | Short Description |
---|---|---|---|
arrow-type | Gtk.ArrowType | r/w | The direction the arrow should point |
shadow-type | Gtk.ShadowType | r/w | Appearance of the shadow surrounding the arrow |
Signals
Name | Short Description |
---|
例子
代码:
#!/usr/bin/env python3
# Created by xiaosanyu at 16/7/14
# section 103
#
# author: xiaosanyu
# website: yuxiaosan.tk \
# http://blog.youkuaiyun.com/a87b01c14
# created: 16/7/14
TITLE = "Arrow"
DESCRIPTION = """
Gtk.Arrow should be used to draw simple arrows that
need to point in one of the four cardinal directions (up, down, left, or right).
"""
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, Gdk, Gio, GLib
class ArrowWindow(Gtk.Window):
def __init__(self, *args, **kwargs):
Gtk.Window.__init__(self, title="Arrow Example")
self.set_size_request(200, 200)
grid = Gtk.Grid()
grid.set_column_homogeneous(True)
grid.set_row_homogeneous(True)
arrow_left = Gtk.Arrow(arrow_type=Gtk.ArrowType.LEFT, shadow_type=Gtk.ShadowType.IN)
arrow_right = Gtk.Arrow(Gtk.ArrowType.RIGHT)
arrow_up = Gtk.Arrow(Gtk.ArrowType.UP)
arrow_down = Gtk.Arrow(Gtk.ArrowType.DOWN)
grid.attach(arrow_left, 0, 1, 1, 1)
grid.attach(arrow_right, 2, 1, 1, 1)
grid.attach(arrow_up, 1, 0, 1, 1)
grid.attach(arrow_down, 1, 2, 1, 1)
self.add(grid)
def main():
win = ArrowWindow()
win.connect("delete-event", Gtk.main_quit)
win.show_all()
Gtk.main()
if __name__ == "__main__":
main()
代码下载地址:http://download.youkuaiyun.com/detail/a87b01c14/9594728