Reputation: 44719
How to refresh a notebook on the fly?
I have an application which is supposed to have various number of pages according to the data in the underlying model. In order to synchronize the appearance of the Notebook I'd like to refresh it every time a row is added/deleted from the model.
I've tried this:
...
def get_pagebox(self, label)
...
return pagebox
def _reinit(self):
for child in self.notebook.get_children():
self.notebook.remove(child)
for label in self.get_labels():
self.notebook.append(self.get_pagebox(label), label)
self.notebook.queue_draw_area(0,0,-1,-1)
...
It removes the old pages, but fails to append new ones. What could be the problem and how do you think this could be done?
Upvotes: 2
Views: 1735
Reputation: 86502
You should just call show_all()
on the notebook after adding the new pages. All widgets created by GTK+ are initially hidden. The queue_draw_area
call shouldn't be necessary.
Upvotes: 4