I’m having difficulty in understanding what it is that the gtk.notebook_set_window_creation_hook_function is looking for in terms of a return value.
According to the documentation, it’s looking for a return value of another notebook you drop it into or None if the drag is cancelled.
Here is my callback example:
def notebook_creation_hook_callback( notebook, page, x, y ):
window = gtk.Window(gtk.WINDOW_TOPLEVEL)
page.reparent(window)
window.move(x,y)
return None
Note: I’m trying to use this function to pull the contents of a notebook tab( page) into its own window without appending it to another notebook. The action works, and I can successfully create the window with the given page, but I get TypeError: GtkNotebook window creation hook function return should be a GtkNotebook or None everytime I do it. And on occasion, a window created in this manner sometimes crashes the entire application with a seg fault.
Can I use this callback function to create a new window out of a dragged page? If not, are there any other methods I could try?
I couldn’t find an answer to my question. But from what I gather with my testing and with the documentation, the
gtk.notebook_set_window_creation_hookfunction is used to drag n drop a notebook tab from one notebook to another. Dropping it into a new window that doesn’t contain a notebook, even with reparenting of the widget leads to glitchy behavior and seg faults.Here is an example of how the callback function for this function hook can look like if you’re creating a new notebook.