On Fri, 23 Jul 2004 10:13:57 +1200, "John C Barstow"
<[EMAIL PROTECTED]> wrote:

> I have a project where, having done GLADE layout for a notebook, I
> need multiple instances of a certain tab. They will all be children of
> the same notebook.

I use something like this:

Create a notebook named "nb_main" in glade and add a single tab to it
with all the widgets you need. Call the container within
the tab "tab_contents" In every callback pass "tab_contents" as
widget. 

The structure shoul be something like

window
 +- notebook
 |   +- tab_contents
 |   |   +- widget1
 |   |   +- widget2
...

In prg.glade you should have something like

 <child>
   <widget class="GtkEntry" id="widget1">
     ...
     <signal name="changed" handler="on_widget1_changed"
object="tab_contents" last_modification_time="Sat, 24 Apr 2004 09:12:57
GMT"/>
   </widget>

When you need a new tab:

tablabel = gtk.Label("New tab")
tablist[maxtab+1]=libglade.XML(gladefile,"tab_contents")
newtab = tablist[maxtab+1].get_widget("tab_contents")
gui.get_widget("nb_main").insert_page(tablabel, newtab)


As all the widgets will have the same name and handler of other tabs,
you must use "tab_contents" to know in which tab the signal was born:

for tab in tablist:
  if tab==passed_widget:
    we are working on this tab


I simplified a lot and used meta-code, but I hope the concept is clear.
:)

Bye.
_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to