本文整理汇总了Python中gtk.main_quit方法的典型用法代码示例。如果您正苦于以下问题:Python gtk.main_quit方法的具体用法?Python gtk.main_quit怎么用?Python gtk.main_quit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gtk
的用法示例。
在下文中一共展示了gtk.main_quit方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import main_quit [as 别名]
def __init__(self):
super(TestForm, self).__init__()
self.set_title("Key test")
self.set_size_request(200, 200)
self.set_position(gtk.WIN_POS_CENTER)
fixed = gtk.Fixed()
entry = gtk.Entry()
fixed.put(entry, 10, 10)
entry.connect("key_press_event", self.on_key_press_event)
self.connect("destroy", gtk.main_quit)
self.add(fixed)
self.show_all()
# Clean the text file:
input_file = open("/tmp/autotest-rv_input", "w")
input_file.close()
示例2: quit
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import main_quit [as 别名]
def quit(self, widget, event=None):
"""Asks if user would like to save file before quitting, then quits the program."""
if self.toSave:
if self.oneConfigFile:
response = gtk.RESPONSE_YES
else:
dialog = gtk.Dialog("Save config?", self, gtk.DIALOG_MODAL, (gtk.STOCK_YES, gtk.RESPONSE_YES, gtk.STOCK_NO, gtk.RESPONSE_NO, gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))
dialog.get_content_area().add(gtk.Label("Save config before quitting?"))
dialog.get_content_area().set_size_request(300, 100)
dialog.show_all()
response = dialog.run()
dialog.destroy()
if response == gtk.RESPONSE_CANCEL:
return True # Return True to stop it quitting when we hit "Cancel"
elif response == gtk.RESPONSE_NO:
gtk.main_quit()
elif response == gtk.RESPONSE_YES:
self.save()
gtk.main_quit()
else:
gtk.main_quit()
示例3: run
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import main_quit [as 别名]
def run(self, graphic):
window = gtk.Window()
self.__window = window
window.set_default_size(200, 200)
vbox = gtk.VBox()
window.add(vbox)
render = GtkGraphicRenderer(graphic)
self.__render = render
vbox.pack_end(render, True, True, 0)
hbox = gtk.HBox()
vbox.pack_start(hbox, False, False, 0)
smaller_zoom = gtk.Button("Zoom Out")
smaller_zoom.connect("clicked", self.__set_smaller_cb)
hbox.pack_start(smaller_zoom)
bigger_zoom = gtk.Button("Zoom In")
bigger_zoom.connect("clicked", self.__set_bigger_cb)
hbox.pack_start(bigger_zoom)
output_png = gtk.Button("Output Png")
output_png.connect("clicked", self.__output_png_cb)
hbox.pack_start(output_png)
window.connect('destroy', gtk.main_quit)
window.show_all()
#gtk.bindings_activate(gtk.main_quit, 'q', 0)
gtk.main()
示例4: _hijack_gtk
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import main_quit [as 别名]
def _hijack_gtk(self):
"""Hijack a few key functions in GTK for IPython integration.
Modifies pyGTK's main and main_quit with a dummy so user code does not
block IPython. This allows us to use %run to run arbitrary pygtk
scripts from a long-lived IPython session, and when they attempt to
start or stop
Returns
-------
The original functions that have been hijacked:
- gtk.main
- gtk.main_quit
"""
def dummy(*args, **kw):
pass
# save and trap main and main_quit from gtk
orig_main, gtk.main = gtk.main, dummy
orig_main_quit, gtk.main_quit = gtk.main_quit, dummy
return orig_main, orig_main_quit
示例5: on_request
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import main_quit [as 别名]
def on_request(view, frame, resource, request, response,
resource_regexp, skip_regexp=None):
"""Check if requested resource matches the video resource_regexp regexp."""
url = request.get_uri()
message = request.get_property("message")
if not message:
return
method = message.get_property("method")
if skip_regexp and skip_regexp.search(url):
# cancel the request
request.set_uri("about:blank")
return
debug("request: %s %s" % (method, url))
if resource_regexp and re.search(resource_regexp, url):
debug("videofile match: %s" % url)
print url
gtk.main_quit()
示例6: inputhook
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import main_quit [as 别名]
def inputhook(context):
"""
When the eventloop of prompt-toolkit is idle, call this inputhook.
This will run the GTK main loop until the file descriptor
`context.fileno()` becomes ready.
:param context: An `InputHookContext` instance.
"""
def _main_quit(*a, **kw):
gtk.main_quit()
return False
gobject.io_add_watch(context.fileno(), gobject.IO_IN, _main_quit)
gtk.main()
示例7: deregister_window
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import main_quit [as 别名]
def deregister_window(self, window):
"""de-register a window widget"""
dbg('Terminator::deregister_window: de-registering %s:%s' %
(id(window), type(window)))
if window in self.windows:
self.windows.remove(window)
else:
err('%s is not in registered window list' % window)
if len(self.windows) == 0:
# We have no windows left, we should exit
dbg('no windows remain, quitting')
gtk.main_quit()
示例8: destroy
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import main_quit [as 别名]
def destroy(self, widget):
gtk.main_quit()
示例9: quit
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import main_quit [as 别名]
def quit(self, action):
# Make sure the step is saved (if the user wants it to be)
self.verify_save()
# Quit
gtk.main_quit()
示例10: shutdown
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import main_quit [as 别名]
def shutdown(self, *args):
gtk.main_quit()
示例11: shutdown
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import main_quit [as 别名]
def shutdown():
gtk.main_quit()
示例12: _quit
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import main_quit [as 别名]
def _quit(self, *dummy_args):
if self._update_timeout_id is not None:
gobject.source_remove(self._update_timeout_id)
self._update_timeout_id = None
self.simulation.quit = True
self.simulation.go.set()
self.simulation.join()
gtk.main_quit()
示例13: _main_quit
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import main_quit [as 别名]
def _main_quit(*args, **kwargs):
gtk.main_quit()
return False
示例14: on_quit
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import main_quit [as 别名]
def on_quit(self, widget, data=None):
gtk.main_quit()
示例15: destroy
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import main_quit [as 别名]
def destroy(widget, data=None):
gtk.main_quit()