Development Team/Almanac/sugar.graphics.notebook: Difference between revisions
Appearance
New page: = Class: Notebook([http://www.pygtk.org/docs/pygtk/ gtk.Notebook]) = Sugar has its own notebook class that is built on top of gtk.Notebook. Use the sugar version so that you can access s... |
m moved Walter is a wanker 12/Almanac/sugar.graphics.notebook to Development Team/Almanac/sugar.graphics.notebook over redirect: revert |
||
| (9 intermediate revisions by 8 users not shown) | |||
| Line 1: | Line 1: | ||
{{Almanac}} | |||
= Class: Notebook([http://www.pygtk.org/docs/pygtk/ gtk.Notebook]) = | = Class: Notebook([http://www.pygtk.org/docs/pygtk/ gtk.Notebook]) = | ||
| Line 25: | Line 27: | ||
self.set_canvas(top_canvas) | self.set_canvas(top_canvas) | ||
</pre> | </pre> | ||
=== How do I do other standard operations on a sugar Notebook? === | |||
Most other work with the sugarized notebook can be done by using the [http://www.pygtk.org/docs/pygtk/class-gtknotebook.html gtk.Notebook] interface | |||
Latest revision as of 20:32, 23 February 2010
For Developers: almanac · api · bugs · gitorious · cgit · download · people · OLPC: wiki · activities · trac · cgit · build index · repository · firmware · Fedora: packages
Class: Notebook(gtk.Notebook)
Sugar has its own notebook class that is built on top of gtk.Notebook. Use the sugar version so that you can access specialized methods as needed.
How do I create a new notebook and populate it with pages?
The simple example below creates three pages, each with different types of containers. You can make anything a page in your notebook as long as it is a valid gtk container.
from sugar.graphics.notebook import Notebook
...
top_canvas = Notebook()
#Create pages for the notebook
first_page = gtk.VBox()
second_page = gtk.VBox()
third_page = gtk.Frame()
#Add the pages to the notebook.
top_box.add_page('First Page', first_page)
top_box.add_page('Second Page', second_page)
top_box.add_page('Third_Page', third_page)
#Set the canvas for this activity's UI to be the notebook object just created.
self.set_canvas(top_canvas)
How do I do other standard operations on a sugar Notebook?
Most other work with the sugarized notebook can be done by using the gtk.Notebook interface