Python gtk.WIN_POS_CENTER Examples
The following are 9
code examples of gtk.WIN_POS_CENTER().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
gtk
, or try the search function
.
![](https://www.programcreek.com/common/static/images/search.png)
Example #1
Source File: key_event_form.py From avocado-vt with GNU General Public License v2.0 | 6 votes |
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()
Example #2
Source File: user_messenger.py From deluge-FileBotTool with GNU General Public License v3.0 | 5 votes |
def __init__(self, title, message, parent=None, modal=False): if modal: modal = gtk.DIALOG_MODAL else: modal = 0 gtk.Dialog.__init__(self, title, parent, modal, (gtk.STOCK_OK, gtk.RESPONSE_OK)) self.message = message label = gtk.Label(message) self.get_content_area().add(label) self.set_position(gtk.WIN_POS_CENTER) self.set_gravity(gtk.gdk.GRAVITY_CENTER) self.show_all()
Example #3
Source File: user_messenger.py From deluge-FileBotTool with GNU General Public License v3.0 | 5 votes |
def __init__(self, title, message, parent=None, modal=True, buttons=None): if not buttons: buttons = (gtk.STOCK_OK, gtk.RESPONSE_ACCEPT, gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL) modal = gtk.DIALOG_MODAL if modal else 0 super(self.__class__, self).__init__(title, parent, modal, buttons) self.message = message label = gtk.Label(message) self.get_content_area().add(label) self.set_gravity(gtk.gdk.GRAVITY_CENTER) self.set_position(gtk.WIN_POS_CENTER) self.show_all()
Example #4
Source File: gtk-example.py From SimpleCV2 with BSD 3-Clause "New" or "Revised" License | 5 votes |
def __init__(self): super(app, self).__init__() self.set_position(gtk.WIN_POS_CENTER) self.set_title("Edge Threshold Adjuster") self.set_decorated(True) self.set_has_frame(False) self.set_resizable(False) self.set_default_size(self.window_width,self.window_height) self.connect("destroy", gtk.main_quit) vbox = gtk.VBox(spacing=4) #Setup the slider bar scale = gtk.HScale() scale.set_range(self.min_threshold, self.max_threshold) scale.set_size_request(500, 25) scale.set_value((self.max_threshold + self.min_threshold) / 2) scale.connect("value-changed", self.update_threshold) vbox.add(scale) #Setup the information label info = gtk.Label() info.set_label("Move the slider to adjust the edge detection threshold") vbox.add(info) #Add the image to the display new_image = self.process_image() converted_image = gtk.gdk.pixbuf_new_from_array(new_image, gtk.gdk.COLORSPACE_RGB, 8) image = gtk.Image() image.set_from_pixbuf(converted_image) image.show() vbox.add(image) self.current_image = image self.add(vbox) self.show_all()
Example #5
Source File: gtk-example-camera.py From SimpleCV2 with BSD 3-Clause "New" or "Revised" License | 5 votes |
def __init__(self): super(app, self).__init__() self.set_position(gtk.WIN_POS_CENTER) self.set_title("Edge Threshold Adjuster") self.set_decorated(True) self.set_has_frame(False) self.set_resizable(False) self.set_default_size(self.window_width,self.window_height) self.connect("destroy", gtk.main_quit) vbox = gtk.VBox(spacing=4) #Setup the slider bar scale = gtk.HScale() scale.set_range(self.min_threshold, self.max_threshold) scale.set_size_request(500, 25) scale.set_value((self.max_threshold + self.min_threshold) / 2) scale.connect("value-changed", self.update_threshold) vbox.add(scale) #Setup the information label info = gtk.Label() info.set_label("Move the slider to adjust the edge detection threshold") vbox.add(info) #Add the image to the display new_image = self.process_image() converted_image = gtk.gdk.pixbuf_new_from_array(new_image, gtk.gdk.COLORSPACE_RGB, 8) image = gtk.Image() image.set_from_pixbuf(converted_image) image.show() vbox.add(image) gobject.timeout_add(self.refresh_rate, self.refresh) self.current_image = image self.add(vbox) self.show_all()
Example #6
Source File: gtkbase.py From gui-o-matic with GNU Lesser General Public License v3.0 | 5 votes |
def _main_window_setup(self, _now=False): def create(self): wcfg = self.config['main_window'] window = gtk.Window(gtk.WINDOW_TOPLEVEL) self.main_window = {'window': window} if wcfg.get('style', 'default') == 'default': self._main_window_default_style() else: raise NotImplementedError('We only have one style atm.') if wcfg.get('close_quits'): window.connect('delete-event', lambda w, e: gtk.main_quit()) else: window.connect('delete-event', lambda w, e: w.hide() or True) window.connect("destroy", lambda wid: gtk.main_quit()) window.set_title(self.config.get('app_name', 'gui-o-matic')) window.set_decorated(True) if wcfg.get('center', False): window.set_position(gtk.WIN_POS_CENTER) window.set_size_request( wcfg.get('width', 360), wcfg.get('height',360)) if wcfg.get('show'): window.show_all() if _now: create(self) else: gobject.idle_add(create, self)
Example #7
Source File: radmin.py From rpy2 with GNU General Public License v2.0 | 5 votes |
def get_splash(): splash = gtk.Window(gtk.WINDOW_TOPLEVEL) splash.set_events(splash.get_events() | gtk.gdk.BUTTON_PRESS_MASK) def f(widget, data=None): splash.destroy() splash.connect('button_press_event', f) eb = gtk.EventBox() eb.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse("white")) image = gtk.Image() image.show() image.set_from_file(os.path.join(rpy2.__path__[0], "images", "rpy2_logo.png")) splashVBox = gtk.VBox() splashVBox.pack_start(image, True, True, 0) splashVBox.pack_start(gtk.Label("A GTK+ toy user interface"), True, True, 0) eb.add(splashVBox) splash.add(eb) splash.realize() splash.window.set_type_hint (gtk.gdk.WINDOW_TYPE_HINT_SPLASHSCREEN) # needed on Win32 splash.set_decorated (False) splash.set_position (gtk.WIN_POS_CENTER) return splash
Example #8
Source File: goagent-gtk.py From arkc-client with GNU General Public License v2.0 | 4 votes |
def __init__(self, window, terminal): self.window = window self.window.set_size_request(652, 447) self.window.set_position(gtk.WIN_POS_CENTER) self.window.connect('delete-event',self.delete_event) self.terminal = terminal for cmd in ('python2.7', 'python27', 'python2'): if os.system('which %s' % cmd) == 0: self.command[1] = cmd break self.window.add(terminal) self.childpid = self.terminal.fork_command(self.command[0], self.command, os.getcwd()) if self.childpid > 0: self.childexited = self.terminal.connect('child-exited', self.on_child_exited) self.window.connect('delete-event', lambda w, e: gtk.main_quit()) else: self.childexited = None spawn_later(0.5, self.show_startup_notify) if should_visible(): self.window.show_all() logo_filename = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'goagent-logo.png') if not os.path.isfile(logo_filename): with open(logo_filename, 'wb') as fp: fp.write(base64.b64decode(GOAGENT_LOGO_DATA)) self.window.set_icon_from_file(logo_filename) if appindicator: self.trayicon = appindicator.Indicator('GoAgent', 'indicator-messages', appindicator.CATEGORY_APPLICATION_STATUS) self.trayicon.set_status(appindicator.STATUS_ACTIVE) self.trayicon.set_attention_icon('indicator-messages-new') self.trayicon.set_icon(logo_filename) self.trayicon.set_menu(self.make_menu()) else: self.trayicon = gtk.StatusIcon() self.trayicon.set_from_file(logo_filename) self.trayicon.connect('popup-menu', lambda i, b, t: self.make_menu().popup(None, None, gtk.status_icon_position_menu, b, t, self.trayicon)) self.trayicon.connect('activate', self.show_hide_toggle) self.trayicon.set_tooltip('GoAgent') self.trayicon.set_visible(True)
Example #9
Source File: gtkbase.py From gui-o-matic with GNU Lesser General Public License v3.0 | 4 votes |
def show_splash_screen(self, height=None, width=None, progress_bar=False, background=None, message=None, message_x=0.5, message_y=0.5, _now=False): wait_lock = threading.Lock() def show(self): self.hide_splash_screen(_now=True) window = gtk.Window(gtk.WINDOW_TOPLEVEL) vbox = gtk.VBox(False, 1) if message: lbl = gtk.Label() lbl.set_markup(message or '') lbl.set_alignment(message_x, message_y) if 'splash' in self.font_styles: lbl.modify_font(self.font_styles['splash']) vbox.pack_start(lbl, True, True) else: lbl = None if background: self._set_background_image(vbox, background) if progress_bar: pbar = gtk.ProgressBar() pbar.set_orientation(gtk.PROGRESS_LEFT_TO_RIGHT) vbox.pack_end(pbar, False, True) else: pbar = None window.set_title(self.config.get('app_name', 'gui-o-matic')) window.set_decorated(False) window.set_position(gtk.WIN_POS_CENTER) window.set_size_request(width or 240, height or 320) window.add(vbox) window.show_all() self.splash = { 'window': window, 'message_x': message_x, 'message_y': message_y, 'vbox': vbox, 'message': lbl, 'progress': pbar} wait_lock.release() with wait_lock: if _now: show(self) else: gobject.idle_add(show, self) wait_lock.acquire()