Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python GTK (Glade) Notebook

Tags:

python

gtk

glade

I'm currently developing a small application in Python with the use of GTK+ (and Glade). Everything has been fairly simple to integrate so far, until I came up with the idea to add tabs instead of pop-ups. Note: Still using Python 2.7+

Is there any easy way to implement already existing pages inside a new tab(notebook) like structure? I'm having difficulties to find how to add content per separate tab created in glade. Perhabs a more 'clear' question: What Notebook function will be required to call a specific V/HBox with every different tab? The current structure looks like (minus Menu / statusbar):

[ mainWindow ] --> (1) mainOverview (gtkVbox) --> (2A) mainContent (gtkHbox) ... other non-related content

The structure I was hoping for would look like:

[ mainWindow ] --> (1) mainOverview --> (2) noteBook --> (3) Tab1 --> (4) mainContent (gtkHbox) -- (3) Tab2 --> (4) secondaryContent (gtkHbox)

The application itself works fine (multithreaded, fully functioning) without the tabs, the mainContent(gtkHbox) contains a file/recursive directory analyzer, a few checkboxes and a general overview. I was hoping for an easy way to display this main window (the gtkHbox) ONLY when having Tab1 selected.

Having difficulties to find good reference pages that display a proper way to call content pages per notebook tab. Any reference-pages or useful links are very much appreciated! Thanks so far! My apologies if this is a rather newbish question, I'm not new to Python coding, but interfaces on the other hand... ;)

like image 917
Mark Avatar asked May 24 '13 22:05

Mark


1 Answers

Not an answer, but it looks like "another.anon.coward" already answered this in a comment...

If you double click on the tab, then that page is selected for adding content in glade. You can go ahead and add content for that page. As for switching you can use set_current_page to switch to page whose content you want to display. Register for "switch-page" signal to find out which page has been switched to.

like image 83
Pyrotherm Avatar answered Oct 21 '22 22:10

Pyrotherm