Re: Real time removal of toolitem
- From: David NeÄas <yeti physics muni cz>
- To: Neil Munro <neilmunro gmail com>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: Real time removal of toolitem
- Date: Sat, 14 Jan 2012 14:16:41 +0100
On Sat, Jan 14, 2012 at 12:34:10PM +0000, Neil Munro wrote:
I was wondering if it is possible to remove a tool item from a
toolbar instantly,
=================================================
from gi.repository import Gtk
def modify(b, t):
if t.get_n_items() == 1:
b.set_stock_id(Gtk.STOCK_REMOVE)
b2 = Gtk.ToolButton.new_from_stock(Gtk.STOCK_HELP)
b2.show_all()
t.insert(b2, 1)
else:
b.set_stock_id(Gtk.STOCK_ADD)
t.get_nth_item(1).destroy()
print t.get_n_items()
w = Gtk.Window()
w.connect('destroy', Gtk.main_quit)
w.set_default_size(200,40)
t = Gtk.Toolbar()
w.add(t)
b = Gtk.ToolButton.new_from_stock(Gtk.STOCK_ADD)
b.connect('clicked', modify, t)
t.insert(b, 0)
w.show_all()
Gtk.main()
=================================================
I have tried
to destroy the widget but it still works, am I missing something
Yes. Hard to tell what.
Yeti
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]