Python gtk 模块,WINDOW_TOPLEVEL 实例源码

我们从Python开源项目中,提取了以下8个代码示例,用于说明如何使用gtk.WINDOW_TOPLEVEL

项目:hostapd-mana    作者:adde88    | 项目源码 | 文件源码
def __init__(self):
        gtk.GtkWindow.__init__(self, gtk.WINDOW_TOPLEVEL)
        self.set_title(self.titleText)
        self.set_default_size(300, 300)
        self.set_name("Manhole")

        vbox = gtk.GtkVBox()
        pane = gtk.GtkVPaned()

        self.output = OutputConsole(toplevel=self)
        pane.pack1(gtkutil.scrollify(self.output), gtk.TRUE, gtk.FALSE)

        self.input = InputText(toplevel=self)
        pane.pack2(gtkutil.scrollify(self.input), gtk.FALSE, gtk.TRUE)
        vbox.pack_start(pane, 1,1,0)

        self.add(vbox)
        self.input.grab_focus()
项目:sslstrip-hsts-openwrt    作者:adde88    | 项目源码 | 文件源码
def __init__(self):
        gtk.GtkWindow.__init__(self, gtk.WINDOW_TOPLEVEL)
        self.set_title(self.titleText)
        self.set_default_size(300, 300)
        self.set_name("Manhole")

        vbox = gtk.GtkVBox()
        pane = gtk.GtkVPaned()

        self.output = OutputConsole(toplevel=self)
        pane.pack1(gtkutil.scrollify(self.output), gtk.TRUE, gtk.FALSE)

        self.input = InputText(toplevel=self)
        pane.pack2(gtkutil.scrollify(self.input), gtk.FALSE, gtk.TRUE)
        vbox.pack_start(pane, 1,1,0)

        self.add(vbox)
        self.input.grab_focus()
项目:chirp_fork    作者:mach327    | 项目源码 | 文件源码
def __init__(self, title, parent=None):
        gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL)
        self.set_modal(True)
        self.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DIALOG)
        self.set_title(title)
        if parent:
            self.set_transient_for(parent)

        self.set_resizable(False)

        vbox = gtk.VBox(False, 2)

        self.label = gtk.Label("")
        self.label.set_size_request(100, 50)
        self.label.show()

        self.pbar = gtk.ProgressBar()
        self.pbar.show()

        vbox.pack_start(self.label, 0, 0, 0)
        vbox.pack_start(self.pbar, 0, 0, 0)

        vbox.show()

        self.add(vbox)
项目:hostapd-mana    作者:adde88    | 项目源码 | 文件源码
def __init__(self, im, desc):
        gtk.GtkWindow.__init__(self, gtk.WINDOW_TOPLEVEL)
        self.set_title(desc)
        self.im = im
        button = cbutton(desc, self.clicked)
        self.entry = gtk.GtkEntry()
        self.entry.connect('activate', self.clicked)
        hb = gtk.GtkHBox()
        hb.add(self.entry)
        hb.add(button)
        self.add(hb)
        self.show_all()
项目:sslstrip-hsts-openwrt    作者:adde88    | 项目源码 | 文件源码
def __init__(self, im, desc):
        gtk.GtkWindow.__init__(self, gtk.WINDOW_TOPLEVEL)
        self.set_title(desc)
        self.im = im
        button = cbutton(desc, self.clicked)
        self.entry = gtk.GtkEntry()
        self.entry.connect('activate', self.clicked)
        hb = gtk.GtkHBox()
        hb.add(self.entry)
        hb.add(button)
        self.add(hb)
        self.show_all()
项目:gimp-fanim    作者:douglasvini    | 项目源码 | 文件源码
def __init__(self,title,image):
        gtk.Window.__init__(self,gtk.WINDOW_TOPLEVEL)

        self.set_title(title)
        self.image = image
        self.frame_bar = None
        # variables
        self.is_playing = False
        self.is_replay = False
        # modifiable widgets
        self.play_button_images = []
        self.widgets_to_disable = [] # widgets to disable when playing
        self.play_bar = None

        # frames
        self.frames = [] # all frame widgets
        self.active = None  # active frame / gimp layer
        self.before_play = None # active frame before play

        self.framerate = 30

        # new frame.
        self.new_layer_type = TRANSPARENT_FILL

        # onionskin variables
        self.oskin = False
        self.oskin_depth = 2
        self.oskin_backward = True
        self.oskin_forward = False
        self.oskin_opacity = 50.0
        self.oskin_opacity_decay = 20.0
        self.oskin_onplay= True

        self.player = None

        # gtk window
        self.win_pos = (20,20)
        self.win_size = (200,200)
        # create all widgets
        self._setup_widgets()
项目:tintwizard    作者:vanadey    | 项目源码 | 文件源码
def __init__(self, tw):
        """Create and shows the window."""
        self.tw = tw

        # Create top-level window
        gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL)

        self.set_title("Preferences")
        self.connect("delete_event", self.quit)

        self.layout = gtk.Table(2, 2, False)

        self.table = gtk.Table(5, 2, False)
        self.table.set_row_spacings(5)
        self.table.set_col_spacings(5)

        createLabel(self.table, text="Default Font", gridX=0, gridY=0)
        self.font = gtk.FontButton(self.tw.defaults["font"])
        self.font.set_alignment(0, 0.5)
        self.table.attach(self.font, 1, 2, 0, 1, xoptions=gtk.EXPAND, yoptions=gtk.EXPAND)

        createLabel(self.table, text="Default Background Color", gridX=0, gridY=1)
        self.bgColor = gtk.ColorButton(gtk.gdk.color_parse(self.tw.defaults["bgColor"]))
        self.bgColor.set_alignment(0, 0.5)
        self.table.attach(self.bgColor, 1, 2, 1, 2, xoptions=gtk.EXPAND, yoptions=gtk.EXPAND)

        createLabel(self.table, text="Default Foreground Color", gridX=0, gridY=2)
        self.fgColor = gtk.ColorButton(gtk.gdk.color_parse(self.tw.defaults["fgColor"]))
        self.fgColor.set_alignment(0, 0.5)
        self.table.attach(self.fgColor, 1, 2, 2, 3, xoptions=gtk.EXPAND, yoptions=gtk.EXPAND)

        createLabel(self.table, text="Default Border Color", gridX=0, gridY=3)
        self.borderColor = gtk.ColorButton(gtk.gdk.color_parse(self.tw.defaults["borderColor"]))
        self.borderColor.set_alignment(0, 0.5)
        self.table.attach(self.borderColor, 1, 2, 3, 4, xoptions=gtk.EXPAND, yoptions=gtk.EXPAND)

        createLabel(self.table, text="Number of background styles", gridX=0, gridY=4)
        self.bgCount = createEntry(self.table, maxSize=6, width=8, text=str(self.tw.defaults["bgCount"]), gridX=1, gridY=4, xExpand=True, yExpand=True)

        self.layout.attach(self.table, 0, 2, 0, 1, xoptions=gtk.EXPAND, yoptions=gtk.EXPAND, xpadding=20, ypadding=5)

        createButton(self.layout, text="Save", stock=gtk.STOCK_SAVE, name="save", gridX=0, gridY=1, xExpand=True, yExpand=True, handler=self.save)
        createButton(self.layout, text="Cancel", stock=gtk.STOCK_CANCEL, name="cancel", gridX=1, gridY=1, xExpand=True, yExpand=True, handler=self.quit)

        self.add(self.layout)

        self.show_all()
项目:chirp_fork    作者:mach327    | 项目源码 | 文件源码
def test():
    win = gtk.Window(gtk.WINDOW_TOPLEVEL)
    lst = ListWidget([(gobject.TYPE_STRING, "Foo"),
                      (gobject.TYPE_BOOLEAN, "Bar")])

    lst.add_item("Test1", True)
    lst.set_values([("Test2", True), ("Test3", False)])

    lst.show()
    win.add(lst)
    win.show()

    win1 = ProgressDialog("foo")
    win1.show()

    win2 = gtk.Window(gtk.WINDOW_TOPLEVEL)
    lle = LatLonEntry()
    lle.show()
    win2.add(lle)
    win2.show()

    win3 = gtk.Window(gtk.WINDOW_TOPLEVEL)
    lst = TreeWidget([(gobject.TYPE_STRING, "Id"),
                      (gobject.TYPE_STRING, "Value")],
                     1)
    lst.set_values({"Fruit": [("Apple", "Red"), ("Orange", "Orange")],
                    "Pizza": [("Cheese", "Simple"), ("Pepperoni", "Yummy")]})
    lst.add_item("Fruit", "Bananna", "Yellow")
    lst.show()
    win3.add(lst)
    win3.show()

    def print_val(entry):
        if entry.validate():
            print "Valid: %s" % entry.value()
        else:
            print "Invalid"
    lle.connect("activate", print_val)

    lle.set_text("45 13 12")

    try:
        gtk.main()
    except KeyboardInterrupt:
        pass

    print lst.get_values()