After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 157422 - gtk_init_check() is called automatically on import gtk
gtk_init_check() is called automatically on import gtk
Status: RESOLVED WONTFIX
Product: pygtk
Classification: Bindings
Component: general
2.3.x/2.4.x
Other Linux
: Normal normal
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2004-11-05 08:14 UTC by Yevgen Muntyan
Modified: 2005-01-22 21:18 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Yevgen Muntyan 2004-11-05 08:14:51 UTC
gtk_init_check() is called automatically in pygtk. This is wrong because of 
the following: 
 
1) C gtk_init_check() function is called with argc and argv parameters which 
are not necessarily arguments of main() function. In pygtk one needs to modify 
program's real argv array, instead of providing gtk_init() with custom argv, 
if he wants to. 
 
2) new GTK 2.6 provides function gtk_init_with_args(), which can't be 
available in pygtk if gtk_init_check() is called automatically. 
 
3) gtk_disable_set_locale() function is not available. 
 
4) gtk_parse_arguments(), gdk_parse_arguments() functions are not available. 
 
In other words, one may want to use custom gtk initialization instead of 
default gtk_init(). Currently one needs to play with real argv of program. 
Say, is one wants to use custom display, he needs to do: 
 
import sys 
find_and_replace_display_option(sys.argv) 
import gtk 
 
instead of 
 
import gtk 
gtk.init(["--display=somehost:243"]) 
 
Or, in c one could call gtk_parse_args() and call gdk_dispay_open() manually.  
 
Everything from above (except gtk_init_with_args()) is doable in pygtk, but 
needs some extra work instead of plain using functions provided by GTK. In 
most cases automatic calling gtk_init_check() is ok, and it saves some typing 
("gtk.init()"). 
But one extra line of code can't hurt. And I'm sure someone will find another 
cases where automatic calling gtk_init() reduces pygtk's functionality 
comparing to functionality provided by C GTK api.
Comment 1 Gustavo Carneiro 2005-01-22 21:18:34 UTC
I don't think this is a good idea.  We can't force everyone to call gtk.init()
because: 1. people will forget and become frustraded because the program will
crash at next gtk API call; 2. we have to preserve API compatibility, we are
_forbidden_.

So, I'm marking this as WONTFIX.