From: Michele M. <mat...@gm...> - 2009-07-03 08:34:26
|
On Fri, Jul 3, 2009 at 5:49 AM, Bruce Sherwood<Bru...@nc...> wrote: > What platform are you running on? > > I find that on Windows this does work properly running from a command > line. The C++ code does intend to exit the program if we reach the end > of the program and there are no windows visible. However, for some > reason exit doesn't happen on Ubuntu Linux. I didn't yet try on the Mac. > I'm running Ubuntu Jaunty. > It also does not exit on Windows when running from VIDLE or IDLE, maybe > because in the shell window you can still execute statements, such as > scene.visible = True, so you're not really at the end of the program. > Clearly we need some statement that unequivocally kills the program. > I need to exit programmatically from the visual and close the window. I'm using visual together with another main GUI window, so when I close the main also visual should close properly. When I click on the x in the right corner of the window the program closes in a proper way, so why we don't expose the same method to the python interface? http://visualpython.cvs.sourceforge.net/viewvc/visualpython/vpython-core2/src/gtk2/display.cpp?revision=1.57&view=markup I think the method attached with the on_quit_clicked() (line 240) should do the work.. we can give it a try. On a side note making visual a GtkWidget Visual window would give much more control, a nice integration within the gtk main loop, and more sane event handling. Do you think it is a good idea? Regards, Michele P.S.: The application is this one: http://mattions.github.com/neuronvisio/ > Bruce Sherwood > > Michele Mattioni wrote: >> Hello list, >> >> I'm trying to figure out how to close visual from the code and not >> from the GUI, 'cause I need this feature. >> >> Consider the following code: >> >> >> import visual >> import time >> scene = visual.display() >> cyl = visual.cylinder() >> time.sleep(3) >> scene.visible = False >> >> >> if you run it with >> >> python test.py >> >> the command line keeps to be busy and the prompt never show up. >> This does not happen if I click on the x on top of the gui. >> >> I'm missing some bit? >> >> Regards, >> Michele. >> >> ------------------------------------------------------------------------------ >> _______________________________________________ >> Visualpython-users mailing list >> Vis...@li... >> https://lists.sourceforge.net/lists/listinfo/visualpython-users >> > > ------------------------------------------------------------------------------ > _______________________________________________ > Visualpython-users mailing list > Vis...@li... > https://lists.sourceforge.net/lists/listinfo/visualpython-users > |