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


Python Gtk.Table方法代码示例

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


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

示例1: _generate_grid

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Table [as 别名]
def _generate_grid(self):
        row_count = int(math.ceil(
            float(len(self._DISPLAYED_SCREENS)) / self._col_count)
        )

        table = Gtk.Table(row_count, self._col_count, homogeneous=True,
                          hexpand=True, vexpand=True)
        table.props.margin = 0

        for idx, screen in enumerate(self._DISPLAYED_SCREENS):
            row = idx / 2
            col = idx % 2

            screen.create_menu_button(self._change_screen_cb)

            if row % 2:
                style_class = 'appgrid_grey'
            else:
                style_class = 'appgrid_white'

            screen.menu_button.button.get_style_context().add_class(style_class)

            screen.refresh_menu_button()

            table.attach(screen.menu_button.button,
                         col, col + 1, row, row + 1,
                         Gtk.AttachOptions.FILL | Gtk.AttachOptions.EXPAND,
                         Gtk.AttachOptions.FILL, 0, 0)


        scrolled_window = ScrolledWindow(wide_scrollbar=True, vexpand=True,
                                         hexpand=True)
        scrolled_window.get_style_context().add_class('app-grid')
        scrolled_window.add_with_viewport(table)

        return scrolled_window 
开发者ID:KanoComputing,项目名称:kano-settings,代码行数:38,代码来源:home_screen.py

示例2: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Table [as 别名]
def __init__(self, rows, columns, row_padding,
                 column_padding, icon_width, icon_height):

        self.icon_width = icon_width
        self.icon_height = icon_height
        self.row_padding = row_padding
        self.column_padding = column_padding
        self.number_of_rows = rows
        self.number_of_columns = columns

        Gtk.Table.__init__(
            self, self.number_of_rows, self.number_of_columns, True
        )

        self.set_row_spacings(self.row_padding)
        self.set_col_spacings(self.column_padding)

        # The list of items of the form
        # Data structure of the wallpapers
        # self.images = {
        #   image_name: {
        #       'path': path_to_image,
        #       'selected': False,
        #       'unlocked': True,
        #       'button': GtkButton
        #   }
        # }
        self.images = {}

        # To specify the order of packing, we also have a
        # self.button_list
        # This is just to specify the order the buttons should be packed
        self.button_list = [] 
开发者ID:KanoComputing,项目名称:kano-settings,代码行数:35,代码来源:image_table.py

示例3: button

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Table [as 别名]
def button(self):
        cancel = Gtk.Button(stock=Gtk.STOCK_CANCEL)
        cancel.connect("clicked", self.close)
        connect = Gtk.Button(stock=Gtk.STOCK_CONNECT)
        connect.connect("clicked", self.add_to_wpa_supplicant)
        table = Gtk.Table(1, 2, True)
        table.set_col_spacings(10)
        table.attach(connect, 4, 5, 0, 1)
        table.attach(cancel, 3, 4, 0, 1)
        return table 
开发者ID:ghostbsd,项目名称:networkmgr,代码行数:12,代码来源:authentication.py

示例4: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Table [as 别名]
def __init__(self, ssid, bssid, wificard):
        self.wificard = wificard
        self.ssid = ssid
        self.bssid = bssid
        self.window = Gtk.Window()
        self.window.set_title("wi-Fi Network Authetification Required")
        self.window.set_border_width(0)
        # self.window.set_position(Gtk.WIN_POS_CENTER)
        self.window.set_size_request(500, 200)
        # self.window.set_icon_from_file("/usr/local/etc/gbi/logo.png")
        box1 = Gtk.VBox(False, 0)
        self.window.add(box1)
        box1.show()
        box2 = Gtk.VBox(False, 10)
        box2.set_border_width(10)
        box1.pack_start(box2, True, True, 0)
        box2.show()
        # Creating MBR or GPT drive
        title = "Authetification required by %s Wi-Fi Network" % ssid
        label = Gtk.Label("<b><span size='large'>%s</span></b>" % title)
        label.set_use_markup(True)
        pwd_label = Gtk.Label("Password:")
        self.password = Gtk.Entry()
        self.password.set_visibility(False)
        check = Gtk.CheckButton("Show password")
        check.connect("toggled", self.on_check)
        table = Gtk.Table(1, 2, True)
        table.attach(label, 0, 5, 0, 1)
        table.attach(pwd_label, 1, 2, 2, 3)
        table.attach(self.password, 2, 4, 2, 3)
        table.attach(check, 2, 4, 3, 4)
        box2.pack_start(table, False, False, 0)
        box2 = Gtk.HBox(False, 10)
        box2.set_border_width(5)
        box1.pack_start(box2, False, True, 0)
        box2.show()
        # Add create_scheme button
        box2.pack_end(self.button(), True, True, 5)
        self.window.show_all() 
开发者ID:ghostbsd,项目名称:networkmgr,代码行数:41,代码来源:authentication.py

示例5: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Table [as 别名]
def __init__ (self):
        Gtk.Table.__init__(self)
        self.resize( 6, 3 )
        self.graphs = []
        self.values = [] 
开发者ID:gtoonstra,项目名称:bldc-sim,代码行数:7,代码来源:graphline.py

示例6: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Table [as 别名]
def __init__(self, location, ws, weather):
        Gtk.Dialog.__init__(self, 'my-weather-indicator | ' + _('Forecast'))
        self.set_modal(True)
        self.set_destroy_with_parent(True)
        self.connect('destroy', self.close_application)
        self.set_icon_from_file(comun.ICON)
        vbox0 = Gtk.VBox(spacing=5)
        vbox0.set_border_width(5)
        self.get_content_area().add(vbox0)
        label11 = Gtk.Label(label='<b>' + location + '</b>')
        label11.set_markup('<b>' + location + '</b>')
        vbox0.pack_start(label11, True, True, 0)
        frame = Gtk.Frame()
        vbox0.add(frame)
        hbox1 = Gtk.HBox(spacing=5)
        hbox1.set_border_width(5)
        frame.add(hbox1)
        self.ws = ws
        forecast = weather['forecasts']
        self.table = Gtk.Table(rows=9, columns=5, homogeneous=False)
        self.table.set_col_spacings(10)
        self.create_labels()
        if self.ws == 'yahoo':
            total = 2
        if self.ws == 'wunderground':
            total = 4
        else:
            total = 5
        for i in range(0, total):
            self.create_forecast_dor_day(forecast, i)
        hbox1.add(self.table)
        #
        if self.ws == 'yahoo':
            filename = comun.YAHOOLOGO
            web = comun.YAHOOWEB
        elif self.ws == 'worldweatheronline':
            filename = comun.WOLRDWEATHERONLINE
            web = comun.WOLRDWEATHERONLINEWEB
        elif self.ws == 'openweathermap':
            filename = comun.OPENWEATHERMAPLOGO
            web = comun.OPENWEATHERMAPWEB
        elif self.ws == 'wunderground':
            filename = comun.UNDERGROUNDLOGO
            web = comun.UNDERGROUNDWEB
        image = load_image(filename, size=64)
        image.set_alignment(0.5, 0.5)
        button = Gtk.Button()
        button.set_image(image)
        button.connect('clicked', (lambda x: webbrowser.open(web)))
        hbox1.pack_start(button, True, True, 0)
        #
        self.show_all()
        center(self)

        while Gtk.events_pending():
            Gtk.main_iteration()
        self.run()
        self.destroy() 
开发者ID:atareao,项目名称:my-weather-indicator,代码行数:60,代码来源:forecastw.py


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