PyGobject(七十四)Gtk.Widget之Gtk.Scale
2016-08-01 13:24
2201 查看
GtkRange
Methods
Virtual Methods
Properties
Signals
GtkScale
继承关系
Methods
Virtual Methods
Properties
Signals
例子
在介绍Gtk.Scale之前先介绍一下他的父类,Gtk.Range
代码:
代码下载地址:http://download.csdn.net/detail/a87b01c14/9594728
Methods
Virtual Methods
Properties
Signals
GtkScale
继承关系
Methods
Virtual Methods
Properties
Signals
例子
在介绍Gtk.Scale之前先介绍一下他的父类,Gtk.Range
Gtk.Range
Gtk.Range使Adjustment可视化,是Gtk.Scale和Gtk.Scrollbar部件的公共基类。Methods
方法修饰词 | 方法名及参数 |
---|---|
get_adjustment () | |
get_fill_level () | |
get_flippable () | |
get_inverted () | |
get_lower_stepper_sensitivity () | |
get_min_slider_size () | |
get_range_rect () | |
get_restrict_to_fill_level () | |
get_round_digits () | |
get_show_fill_level () | |
get_slider_range () | |
get_slider_size_fixed () | |
get_upper_stepper_sensitivity () | |
get_value () | |
set_adjustment (adjustment) | |
set_fill_level (fill_level) | |
set_flippable (flippable) | |
set_increments (step, page) | |
set_inverted (setting) | |
set_lower_stepper_sensitivity (sensitivity) | |
set_min_slider_size (min_size) | |
set_range (min, max) | |
set_restrict_to_fill_level (restrict_to_fill_level) | |
set_round_digits (round_digits) | |
set_show_fill_level (show_fill_level) | |
set_slider_size_fixed (size_fixed) | |
set_upper_stepper_sensitivity (sensitivity) | |
set_value (value) |
Virtual Methods
do_adjust_bounds (new_value) |
do_change_value (scroll, new_value) |
do_get_range_border (border_) |
do_move_slider (scroll) |
do_value_changed () |
Properties
Name | Type | Flags | Short Description |
---|---|---|---|
adjustment | Gtk.Adjustment | r/w/c | The Gtk.Adjustment that contains the current value of this range object |
fill-level | float | r/w/en | The fill level. |
inverted | bool | r/w/en | Invert direction slider moves to increase range value |
lower-stepper-sensitivity | Gtk.SensitivityType | r/w/en | The sensitivity policy for the stepper that points to the adjustment’s lower side |
restrict-to-fill-level | bool | r/w/en | Whether to restrict the upper boundary to the fill level. |
round-digits | int | r/w/en | The number of digits to round the value to. |
show-fill-level | bool | r/w/en | Whether to display a fill level indicator graphics on trough. |
upper-stepper-sensitivity | Gtk.SensitivityType | r/w/en | The sensitivity policy for the stepper that points to the adjustment’s upper side |
Signals
Name | Short Description |
---|---|
adjust-bounds | Emitted before clamping a value, to give the application a chance to adjust the bounds. |
change-value | The Gtk.Range ::change-value signal is emitted when a scroll action is performed on a range. |
move-slider | Virtual function that moves the slider. |
value-changed | Emitted when the range value changes. |
Gtk.Scale
Gtk.Scale滑动条或刻度尺
继承关系
Gtk.Scale是Gtk.Range的直接子类Methods
方法修饰词 | 方法名及参数 |
---|---|
static | new (orientation, adjustment) |
static | new_with_range (orientation, min, max, step) |
add_mark (value, position, markup) | |
clear_marks () | |
get_digits () | |
get_draw_value () | |
get_has_origin () | |
get_layout () | |
get_layout_offsets () | |
get_value_pos () | |
set_digits (digits) | |
set_draw_value (draw_value) | |
set_has_origin (has_origin) | |
set_value_pos (pos) |
Virtual Methods
do_draw_value () |
do_format_value (value) |
do_get_layout_offsets () |
Properties
Name | Type | Flags | Short Description |
---|---|---|---|
digits | int | r/w/en | The number of decimal places that are displayed in the value |
draw-value | bool | r/w/en | Whether the current value is displayed as a string next to the slider |
has-origin | bool | r/w/en | Whether the scale has an origin |
value-pos | Gtk.PositionType | r/w/en | The position in which the current value is displayed |
Signals
Name | Short Description |
---|---|
format-value | Signal which allows you to change how the scale value is displayed. |
例子
代码:
#!/usr/bin/env python3 # Created by xiaosanyu at 16/7/14 # section 118 # # author: xiaosanyu # website: yuxiaosan.tk \ # http://blog.csdn.net/a87b01c14 # created: 16/7/14 TITLE = "Scale" DESCRIPTION = """ A Gtk.Scale is a slider control used to select a numeric value. To use it, you’ll probably want to investigate the methods on its base class, Gtk.Range, in addition to the methods for Gtk.Scale itself. """ import gi gi.require_version("Gtk", "3.0") from gi.repository import Gtk, Gdk, Gio, GLib class ScaleWindow(Gtk.Window): def __init__(self, *args, **kwargs): Gtk.Window.__init__(self, title="Scale Example") self.set_size_request(250, 200) box = Gtk.VBox(spacing=6) ad1 = Gtk.Adjustment(value=50, lower=0, upper=100, step_increment=1, page_increment=1, page_size=0) ad2 = Gtk.Adjustment(value=50, lower=0, upper=100, step_increment=1, page_increment=1, page_size=0) scale1 = Gtk.Scale(adjustment=ad1) scale1.set_show_fill_level(True) box.pack_start(scale1, False, False, 0) scale2 = Gtk.Scale(adjustment=ad2) for i in [x * 10 for x in range(11)]: scale2.add_mark(i, Gtk.PositionType.BOTTOM) box.pack_start(scale2, False, False, 0) self.add(box) def main(): win = ScaleWindow() win.connect("delete-event", Gtk.main_quit) win.show_all() Gtk.main() if __name__ == "__main__": main()
代码下载地址:http://download.csdn.net/detail/a87b01c14/9594728
相关文章推荐
- PyGobject(七十二)Gtk.Widget之Gtk.SearchEntry
- PyGobject(七十三)Gtk.Widget之Gtk.SpinButton
- PyGobject(七十五)Gtk.Widget之Gtk.Scrollbar
- PyGobject(七十六)Gtk.Widget之Gtk.Spinner
- PyGobject(六十一)Gtk.Widget
- PyGobject(七十七)Gtk.Widget之Gtk.Switch
- PyGobject(十五)布局容器之Button篇——Gtk.ScaleButton
- PyGobject(六十三)Gtk.Widget之Gtk.AccelLabel
- PyGobject(六十四)Gtk.Widget之Gtk.Arrow
- PyGobject(六十五)Gtk.Widget之Gtk.Image
- PyGobject(六十六)Gtk.Widget之Gtk.Calendar
- PyGobject(六十七)Gtk.Widget之Gtk.CellView
- PyGobject(六十八)Gtk.Widget之Gtk.DrawingArea
- PyGobject(六十九)Gtk.Widget之Gtk.LevelBar
- PyGobject(七十)Gtk.Widget之Gtk.ProgressBar
- PyGobject(七十一)Gtk.Widget之Gtk.Entry
- PyGobject(一百一十)代码整合及GtkSource安装使用
- QwtScaleWidget
- Clutter学习(三):在GTK容器中加入Clutter容器——Stage Widget小例子
- PyGobject(十一)布局容器之Button篇——Gtk.RadioButton