当前位置: 首页>>代码示例>>Python>>正文


Python gtk.WIN_POS_CENTER属性代码示例

本文整理汇总了Python中gtk.WIN_POS_CENTER属性的典型用法代码示例。如果您正苦于以下问题:Python gtk.WIN_POS_CENTER属性的具体用法?Python gtk.WIN_POS_CENTER怎么用?Python gtk.WIN_POS_CENTER使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在gtk的用法示例。


在下文中一共展示了gtk.WIN_POS_CENTER属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import WIN_POS_CENTER [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() 
开发者ID:avocado-framework,项目名称:avocado-vt,代码行数:23,代码来源:key_event_form.py

示例2: __init__

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import WIN_POS_CENTER [as 别名]
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() 
开发者ID:Laharah,项目名称:deluge-FileBotTool,代码行数:14,代码来源:user_messenger.py

示例3: __init__

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import WIN_POS_CENTER [as 别名]
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() 
开发者ID:sightmachine,项目名称:SimpleCV2,代码行数:39,代码来源:gtk-example.py

示例4: __init__

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import WIN_POS_CENTER [as 别名]
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() 
开发者ID:sightmachine,项目名称:SimpleCV2,代码行数:40,代码来源:gtk-example-camera.py

示例5: _main_window_setup

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import WIN_POS_CENTER [as 别名]
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) 
开发者ID:mailpile,项目名称:gui-o-matic,代码行数:33,代码来源:gtkbase.py

示例6: get_splash

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import WIN_POS_CENTER [as 别名]
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 
开发者ID:rpy2,项目名称:rpy2,代码行数:27,代码来源:radmin.py

示例7: __init__

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import WIN_POS_CENTER [as 别名]
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) 
开发者ID:projectarkc,项目名称:arkc-client,代码行数:46,代码来源:goagent-gtk.py

示例8: show_splash_screen

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import WIN_POS_CENTER [as 别名]
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() 
开发者ID:mailpile,项目名称:gui-o-matic,代码行数:54,代码来源:gtkbase.py


注:本文中的gtk.WIN_POS_CENTER属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。