PyGobject(七十)Gtk.Widget之Gtk.ProgressBar
2016-08-01 11:28
651 查看
GtkProgressBar
继承关系
Methods
Virtual Methods
Properties
Signals
例子
代码:
代码下载地址:http://download.csdn.net/detail/a87b01c14/9594728
继承关系
Methods
Virtual Methods
Properties
Signals
例子
Gtk.ProgressBar
Gtk.ProgressBar进度条继承关系
Methods
方法修饰词 | 方法名及参数 |
---|---|
static | new () |
get_ellipsize () | |
get_fraction () | |
get_inverted () | |
get_pulse_step () | |
get_show_text () | |
get_text () | |
pulse () | |
set_ellipsize (mode) | |
set_fraction (fraction) | |
set_inverted (inverted) | |
set_pulse_step (fraction) | |
set_show_text (show_text) | |
set_text (text) |
Virtual Methods
Properties
Name | Type | Flags | Short Description |
---|---|---|---|
ellipsize | Pango.EllipsizeMode | r/w/en | The preferred place to ellipsize the string, if the progress bar does not have enough room to display the entire string, if at all. |
fraction | float | r/w/en | The fraction of total work that has been completed |
inverted | bool | r/w/en | Invert the direction in which the progress bar grows |
pulse-step | float | r/w/en | The fraction of total progress to move the bouncing block when pulsed |
show-text | bool | r/w/en | Whether the progress is shown as text. |
text | str | r/w | Text to be displayed in the progress bar |
Signals
Name | Short Description |
---|
例子
代码:
#!/usr/bin/env python3 # Created by xiaosanyu at 16/6/15 # section 111 TITLE = "ProgressBar" DESCRIPTION = """ The Gtk.ProgressBar is typically used to display the progress of a long running operation. It provides a visual clue that processing is underway. """ import gi gi.require_version('Gtk', '3.0') from gi.repository import Gtk, GObject class ProgressBarWindow(Gtk.Window): def __init__(self): Gtk.Window.__init__(self, title="ProgressBar Demo") self.set_border_width(10) vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=6) self.add(vbox) self.progressbar = Gtk.ProgressBar() vbox.pack_start(self.progressbar, True, True, 0) button = Gtk.CheckButton("Show text") button.connect("toggled", self.on_show_text_toggled) vbox.pack_start(button, True, True, 0) button = Gtk.CheckButton("Activity mode") button.connect("toggled", self.on_activity_mode_toggled) vbox.pack_start(button, True, True, 0) button = Gtk.CheckButton("Right to Left") button.connect("toggled", self.on_right_to_left_toggled) vbox.pack_start(button, True, True, 0) self.timeout_id = GObject.timeout_add(50, self.on_timeout, None) self.activity_mode = False def on_show_text_toggled(self, button): show_text = button.get_active() if show_text: text = "some text" else: text = None self.progressbar.set_text(text) self.progressbar.set_show_text(show_text) def on_activity_mode_toggled(self, button): self.activity_mode = button.get_active() if self.activity_mode: self.progressbar.pulse() else: self.progressbar.set_fraction(0.0) def on_right_to_left_toggled(self, button): value = button.get_active() self.progressbar.set_inverted(value) def on_timeout(self, user_data): """ Update value on the progress bar """ if self.activity_mode: self.progressbar.pulse() else: new_value = self.progressbar.get_fraction() + 0.01 if new_value > 1: new_value = 0 self.progressbar.set_fraction(new_value) # As this is a timeout function, return True so that it # continues to get called return True def main(): win = ProgressBarWindow() 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.Calendar
- PyGobject(六十七)Gtk.Widget之Gtk.CellView
- PyGobject(六十八)Gtk.Widget之Gtk.DrawingArea
- PyGobject(六十九)Gtk.Widget之Gtk.LevelBar
- PyGobject(七十一)Gtk.Widget之Gtk.Entry
- PyGobject(七十二)Gtk.Widget之Gtk.SearchEntry
- PyGobject(七十三)Gtk.Widget之Gtk.SpinButton
- PyGobject(七十四)Gtk.Widget之Gtk.Scale
- PyGobject(七十五)Gtk.Widget之Gtk.Scrollbar
- PyGobject(七十六)Gtk.Widget之Gtk.Spinner
- PyGobject(六十一)Gtk.Widget
- PyGobject(七十七)Gtk.Widget之Gtk.Switch
- PyGobject(六十三)Gtk.Widget之Gtk.AccelLabel
- PyGobject(六十四)Gtk.Widget之Gtk.Arrow
- PyGobject(六十五)Gtk.Widget之Gtk.Image
- PyGobject(十)布局容器之Button篇——Gtk.CheckButton
- PyGobject(八十)Gtk.Clipboard
- Android GUI Widget ProgressBar
- 一个progressbar widget
- PyGobject(十一)布局容器之Button篇——Gtk.RadioButton