in reply to Can't call method "get_screen" on an undefined value

I'm guessing that you can't call get_screen until the mainwindow is actually mapped to the screen, or is visible. Your window does not become visible until the show_all() command.

There are probably a couple of ways to deal with it. One is to put the get_screen after the show_all, possibly with a short timer, but a better way would be to find out how to test for visibility, by seeing if the $mw is mapped.

I don't have an example handy, but google for how to detect if a Gtk3 window is mapped, or present. Try finding the event for window_is_mapped or present(). Then you could use the is_mapped callback to run get_screen().


I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh
  • Comment on Re: Can't call method "get_screen" on an undefined value