本文整理汇总了Python中gtk.ToggleButton方法的典型用法代码示例。如果您正苦于以下问题:Python gtk.ToggleButton方法的具体用法?Python gtk.ToggleButton怎么用?Python gtk.ToggleButton使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gtk
的用法示例。
在下文中一共展示了gtk.ToggleButton方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import ToggleButton [as 别名]
def __init__(self):
assert Visualizer.INSTANCE is None
Visualizer.INSTANCE = self
super(Visualizer, self).__init__()
self.nodes = {} # node index -> Node
self.channels = {} # id(ns3.Channel) -> Channel
self.window = None # toplevel window
self.canvas = None # goocanvas.Canvas
self.time_label = None # gtk.Label
self.play_button = None # gtk.ToggleButton
self.zoom = None # gtk.Adjustment
self._scrolled_window = None # gtk.ScrolledWindow
self.links_group = goocanvas.Group()
self.channels_group = goocanvas.Group()
self.nodes_group = goocanvas.Group()
self._update_timeout_id = None
self.simulation = SimulationThread(self)
self.selected_node = None # node currently selected
self.speed = 1.0
self.information_windows = []
self._transmission_arrows = []
self._last_transmissions = []
self._drop_arrows = []
self._last_drops = []
self._show_transmissions_mode = None
self.set_show_transmissions_mode(ShowTransmissionsMode.ALL)
self._panning_state = None
self.node_size_adjustment = None
self.transmissions_smoothing_adjustment = None
self.sample_period = SAMPLE_PERIOD
self.node_drag_state = None
self.follow_node = None
self.shell_window = None
self.create_gui()
for plugin in plugins:
plugin(self)
示例2: __init__
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import ToggleButton [as 别名]
def __init__(self, width, height):
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
self.window.connect("delete_event", self.delete_event)
self.window.connect("destroy", self.destroy)
self.window.set_border_width(0)
self.window.set_size_request(width, height + 30)
self.window.set_app_paintable(True)
self.screen = self.window.get_screen()
self.rgba = self.screen.get_rgba_colormap()
self.window.set_colormap(self.rgba)
self.window.connect('expose-event', self.expose)
self.vbox = gtk.VBox(False, 5)
self.hbox = gtk.HBox(False, 3)
self.bbox = gtk.HBox(True, 3)
self.entry = gtk.Entry()
self.entry.set_max_length(0)
self.entry.set_size_request(int(width/2), 25)
self.entry.connect("activate", self.enter_callback, self.entry)
self.spr = gtk.ToggleButton(label='spr')
self.spr.connect("toggled", self.on_button_toggled, 'spr')
self.ctrl = gtk.ToggleButton(label='ctrl')
self.ctrl.connect("toggled", self.on_button_toggled, 'ctrl')
self.alt = gtk.ToggleButton(label='alt')
self.alt.connect("toggled", self.on_button_toggled, 'alt')
self.enter = gtk.Button(label='Enter')
self.enter.connect("clicked", self.on_enter_clicked)
self.backspace = gtk.Button(label='Backspace')
self.backspace.connect("clicked", self.on_backspace_clicked)
self.shell = gtk.Button(label='R-Shell')
self.shell.connect("clicked", self.on_shell_clicked, self.entry)
self.hbox.add(self.entry)
self.bbox.add(self.spr)
self.bbox.add(self.ctrl)
self.bbox.add(self.alt)
self.bbox.add(self.enter)
self.bbox.add(self.backspace)
self.bbox.add(self.shell)
self.hbox.add(self.bbox)
self.halign = gtk.Alignment(1, 0, 1, 0)
self.halign.add(self.hbox)
self.allalign = gtk.Alignment(0, 0, 1, 1)
self.clickbox = gtk.EventBox()
self.clickbox.connect('button-press-event', self.on_click)
self.clickbox.set_visible_window(False)
self.allalign.add(self.clickbox)
self.vbox.pack_start(self.allalign, True, True, 0)
self.vbox.pack_end(self.halign, False, False, 0)
self.window.add(self.vbox)
self.window.show_all()
self.window.move(100, 100)
示例3: __init__
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import ToggleButton [as 别名]
def __init__(self):
"""!
Initializer function.
@param self: class object.
@return none
"""
assert Visualizer.INSTANCE is None
Visualizer.INSTANCE = self
super(Visualizer, self).__init__()
self.nodes = {} # node index -> Node
self.channels = {} # id(ns3.Channel) -> Channel
self.window = None # toplevel window
self.canvas = None # goocanvas.Canvas
self.time_label = None # gtk.Label
self.play_button = None # gtk.ToggleButton
self.zoom = None # gtk.Adjustment
self._scrolled_window = None # gtk.ScrolledWindow
self.links_group = goocanvas.Group()
self.channels_group = goocanvas.Group()
self.nodes_group = goocanvas.Group()
self._update_timeout_id = None
self.simulation = SimulationThread(self)
self.selected_node = None # node currently selected
self.speed = 1.0
self.information_windows = []
self._transmission_arrows = []
self._last_transmissions = []
self._drop_arrows = []
self._last_drops = []
self._show_transmissions_mode = None
self.set_show_transmissions_mode(ShowTransmissionsMode.ALL)
self._panning_state = None
self.node_size_adjustment = None
self.transmissions_smoothing_adjustment = None
self.sample_period = SAMPLE_PERIOD
self.node_drag_state = None
self.follow_node = None
self.shell_window = None
self.create_gui()
for plugin in plugins:
plugin(self)