Re: the number in Gtk.table





2013/2/10 æéææ <1248283536 qq com>

from gi.repository import Gtk

class TableWindow(Gtk.Window):

  def __init__(self):
    Gtk.Window.__init__(self, title="Table Example")

    table = Gtk.Table(3, 3, True)
    self.add(table)

    button1 = Gtk.Button(label="Button 1")
    button2 = Gtk.Button(label="Button 2")
    button3 = Gtk.Button(label="Button 3")
    button4 = Gtk.Button(label="Button 4")
    button5 = Gtk.Button(label="Button 5")
    button6 = Gtk.Button(label="Button 6")

    table.attach(button1, 0, 1, 0, 1)
    table.attach(button2, 1, 3, 0, 1)
    table.attach(button3, 0, 1, 1, 3)
    table.attach(button4, 1, 3, 1, 2)
    table.attach(button5, 1, 2, 2, 3)
    table.attach(button6, 2, 3, 2, 3)

win = TableWindow()
win.connect("delete-event", Gtk.main_quit)
win.show_all()
Gtk.main()

when run the code ,i get Âthe attatchment,why ÂÂtable.attach(button2, 1, 3, 0, 1) Â,what is the meaning of Â1,3,0,1?

left_attach, right_attach, top_attach, bottom_attach: http://developer.gnome.org/gtk3/3.6/GtkTable.html#gtk-table-attach
So 1, 3 will span 2 columns.

You should move on to Gtk.Grid however: http://developer.gnome.org/gtk3/3.6/GtkGrid.html

Timo

Â

_______________________________________________
python-hackers-list mailing list
python-hackers-list gnome org
https://mail.gnome.org/mailman/listinfo/python-hackers-list




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]