我们从Python开源项目中,提取了以下7个代码示例,用于说明如何使用gtk.BUTTONS_CLOSE。
def _ebFailedLogin(self, reason): if isinstance(reason, failure.Failure): reason = reason.value self.statusMsg(reason) if isinstance(reason, (unicode, str)): text = reason else: text = unicode(reason) msg = gtk.MessageDialog(self._loginDialog, gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_ERROR, gtk.BUTTONS_CLOSE, text) msg.show_all() msg.connect("response", lambda *a: msg.destroy()) # hostname not found # host unreachable # connection refused # authentication failed # no such service # no such perspective # internal server error
def gui_message(text, message_type): """Gtk dialog for error message display""" message = gtk.MessageDialog(type=message_type, buttons=gtk.BUTTONS_CLOSE) message.set_markup(text) message.run() message.destroy() while gtk.events_pending(): gtk.main_iteration()
def show_alert_message(parent_window, msg): alert = gtk.MessageDialog(parent_window, gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_INFO, gtk.BUTTONS_CLOSE, msg) alert.run() alert.destroy()
def show_error_message(parent_window, msg): alert = gtk.MessageDialog(parent_window, gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_ERROR, gtk.BUTTONS_CLOSE, msg) alert.run() alert.destroy()
def parse_all(self, event): for collector in self.engine.collectors: collector.parser.parse() # alert = gtk.MessageDialog(self, gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_INFO, # gtk.BUTTONS_CLOSE, "Parsing complete") # alert.run() # alert.destroy()
def __init__(self, parent, notebook): Dialog.__init__(self, parent, _('Pages By Number Of Links'), # T: dialog title buttons=gtk.BUTTONS_CLOSE ) self.notebook = notebook self.direction_input = gtk.combo_box_new_text() for dir in sorted(self.LABELS): self.direction_input.append_text(self.LABELS[dir]) self.uistate.setdefault('link_direction', LINK_DIR_BACKWARD, self.LABELS.keys()) gtk_combobox_set_active_text( self.direction_input, self.LABELS[self.uistate['link_direction']] ) self.direction_input.connect('changed', self.on_direction_input_changed) hbox = gtk.HBox() hbox.pack_start(gtk.Label(_('Trace Links')+':'), False) hbox.add(self.direction_input) self.vbox.pack_start(hbox, False) self.listview = SingleClickTreeView(gtk.ListStore(int, str)) self.listview.set_reorderable(True) for i, label in enumerate((_('#'), _('Page'))): column = gtk.TreeViewColumn(label, gtk.CellRendererText(), text=i) column.set_sort_column_id(i) self.listview.append_column(column) # TODO: self.listview.connect('row-activated', self.on_row_activated()) self.vbox.add(ScrolledWindow(self.listview)) self.populate_listview()