class TiebaWindow(gtk.Window): def __init__(self): gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL) self.set_size_request(600, 450) self.set_position(gtk.WIN_POS_CENTER) self.connect("delete-event", gtk.main_quit) self.accounts_view = AccountView() self.__init_accounts() scrolled_window = gtk.ScrolledWindow() scrolled_window.add(self.accounts_view) self.add(scrolled_window) self.show_all() gtk.main() def __init_accounts(self): default_pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(os.path.join(DATA_DIR, "default_user.jpg"), 32, 32) items = [] items.append(({"icon" : default_pixbuf, "user_name" : "小邪兽", "passwd" : "123456", "status" : 0},)) items.append(({"icon" : default_pixbuf, "user_name" : "小邪兽", "passwd" : "123456", "status" : 0},)) items.append(({"icon" : default_pixbuf, "user_name" : "小邪兽", "passwd" : "123456", "status" : 0},)) items.append(({"icon" : default_pixbuf, "user_name" : "小邪兽", "passwd" : "123456", "status" : 0},)) items.append(({"icon" : default_pixbuf, "user_name" : "小邪兽", "passwd" : "123456", "status" : 0},)) items.append(({"icon" : default_pixbuf, "user_name" : "小邪兽", "passwd" : "123456", "status" : 0},)) items.append(({"icon" : default_pixbuf, "user_name" : "小邪兽", "passwd" : "123456", "status" : 0},)) items.append(({"icon" : default_pixbuf, "user_name" : "小邪兽", "passwd" : "123456", "status" : 0},)) self.accounts_view.set_items(items)
def __init__(self): gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL) self.set_size_request(600, 450) self.set_position(gtk.WIN_POS_CENTER) self.connect("delete-event", gtk.main_quit) self.accounts_view = AccountView() self.__init_accounts() scrolled_window = gtk.ScrolledWindow() scrolled_window.add(self.accounts_view) self.add(scrolled_window) self.show_all() gtk.main()
class TiebaWindow(gtk.Window): def __init__(self): gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL) self.set_size_request(600, 450) self.set_position(gtk.WIN_POS_CENTER) self.connect("delete-event", gtk.main_quit) self.accounts_view = AccountView() self.__init_accounts() scrolled_window = gtk.ScrolledWindow() scrolled_window.add(self.accounts_view) self.add(scrolled_window) self.show_all() gtk.main() def __init_accounts(self): default_pixbuf = gtk.gdk.pixbuf_new_from_file_at_size( os.path.join(DATA_DIR, "default_user.jpg"), 32, 32) items = [] items.append(({ "icon": default_pixbuf, "user_name": "小邪兽", "passwd": "123456", "status": 0 }, )) items.append(({ "icon": default_pixbuf, "user_name": "小邪兽", "passwd": "123456", "status": 0 }, )) items.append(({ "icon": default_pixbuf, "user_name": "小邪兽", "passwd": "123456", "status": 0 }, )) items.append(({ "icon": default_pixbuf, "user_name": "小邪兽", "passwd": "123456", "status": 0 }, )) items.append(({ "icon": default_pixbuf, "user_name": "小邪兽", "passwd": "123456", "status": 0 }, )) items.append(({ "icon": default_pixbuf, "user_name": "小邪兽", "passwd": "123456", "status": 0 }, )) items.append(({ "icon": default_pixbuf, "user_name": "小邪兽", "passwd": "123456", "status": 0 }, )) items.append(({ "icon": default_pixbuf, "user_name": "小邪兽", "passwd": "123456", "status": 0 }, )) self.accounts_view.set_items(items)