您的位置:首页 > 移动开发 > Objective-C

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

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

NameTypeFlagsShort Description
adjustmentGtk.Adjustmentr/w/cThe Gtk.Adjustment that contains the current value of this range object
fill-levelfloatr/w/enThe fill level.
invertedboolr/w/enInvert direction slider moves to increase range value
lower-stepper-sensitivityGtk.SensitivityTyper/w/enThe sensitivity policy for the stepper that points to the adjustment’s lower side
restrict-to-fill-levelboolr/w/enWhether to restrict the upper boundary to the fill level.
round-digitsintr/w/enThe number of digits to round the value to.
show-fill-levelboolr/w/enWhether to display a fill level indicator graphics on trough.
upper-stepper-sensitivityGtk.SensitivityTyper/w/enThe sensitivity policy for the stepper that points to the adjustment’s upper side

Signals

NameShort Description
adjust-boundsEmitted before clamping a value, to give the application a chance to adjust the bounds.
change-valueThe Gtk.Range ::change-value signal is emitted when a scroll action is performed on a range.
move-sliderVirtual function that moves the slider.
value-changedEmitted when the range value changes.

Gtk.Scale

Gtk.Scale滑动条或刻度尺


继承关系

Gtk.Scale是Gtk.Range的直接子类





Methods

方法修饰词方法名及参数
staticnew (orientation, adjustment)
staticnew_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

NameTypeFlagsShort Description
digitsintr/w/enThe number of decimal places that are displayed in the value
draw-valueboolr/w/enWhether the current value is displayed as a string next to the slider
has-originboolr/w/enWhether the scale has an origin
value-posGtk.PositionTyper/w/enThe position in which the current value is displayed

Signals

NameShort Description
format-valueSignal 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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息