GTK wxPython without X-server - silent shell exit

OK - I did a web search (google) on this:
for 'gtk_init' I find here:
http://developer.gnome.org/doc/API/2.0/gtk/gtk-General.html
this:
Before using GTK+, you need to initialize it; initialization connects to the window system display, and parses some standard command line arguments. The gtk_init() function initializes GTK+. gtk_init() exits the application if errors occur; to avoid this, use gtk_init_check(). gtk_init_check() allows you to recover from a failed GTK+ initialization - you might start up your application in text mode instead.

Is gtk_init_check() available already in GTK1.2 ?
BTW, I use wxPython 2.4.2 - GTK1 (not GTK2)

Thanks,
Sebastian Haase

···

On Thu, 25 Mar 2004 12:03:53 -0800 Sebastian Haase <haase@msg.ucsf.edu> wrote:

Hi,
sorry for the weird subject...
Try 'import wx' when you sit in some console only python shell.
This happend e.g. when you ssh(telnet) into some machine and the DISPLAY environment variable isn't set.
Instead of getting a exception the shell just silently exits.

I guess this comes from deep inside the library where "gtk_init()" (don't know what the real function name is) get's called (and fails).

Can this be changed to raising an exception ?

Thanks,
Sebastian Haase

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org

Sebastian Haase wrote:

OK - I did a web search (google) on this:
for 'gtk_init' I find here:
http://developer.gnome.org/doc/API/2.0/gtk/gtk-General.html
this:
Before using GTK+, you need to initialize it; initialization connects to the window system display, and parses some standard command line arguments. The gtk_init() function initializes GTK+. gtk_init() exits the application if errors occur; to avoid this, use gtk_init_check(). gtk_init_check() allows you to recover from a failed GTK+ initialization - you might start up your application in text mode instead.
Is gtk_init_check() available already in GTK1.2 ?

Yes I think it is, but the problem is that the place it would be called from is burried deep in wxGTK and so if it fails we may not be able to raise a Python exception that explains why it failed. I've got it on my ToDo list to experiment with this though so we'll see what happens.

BTW, in 2.5 the init won't happen until the wx.App object is created, so it will be easier to add something there that checks for the DISPLAY independently of gtk_init if that makes more sense. (And there was some code posted here or on wxPython-dev a few months ago that does something like that.)

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!