如何避免Tkinter、visual和ipython导致的Gdk错误?
当我关闭tk窗口实例如何避免Tkinter、visual和ipython导致的Gdk错误?,python,tkinter,Python,Tkinter,当我关闭tk窗口实例a时,以下几行会导致ipython崩溃 import visual, Tkinter a = Tkinter.Tk() a.update() display = visual.display(title = "Hallo") display.exit = 0 visual.sphere() 如果我先关闭视觉显示器,整个终端就会崩溃。我在kubuntu 8.10上运行所有程序。这是一个错误还是我做错了什么?如果这是一个bug:有没有明智的方法来避免它 干杯,Philipp您是
a
时,以下几行会导致ipython崩溃
import visual, Tkinter
a = Tkinter.Tk()
a.update()
display = visual.display(title = "Hallo")
display.exit = 0
visual.sphere()
如果我先关闭视觉显示器,整个终端就会崩溃。我在kubuntu 8.10上运行所有程序。这是一个错误还是我做错了什么?如果这是一个bug:有没有明智的方法来避免它
干杯,Philipp您是否尝试过使用
-gthread-tk
命令行开关启动ipython
从ipython--help
:
-gthread, -qthread, -q4thread, -wthread, -pylab
Only ONE of these can be given, and it can only be given as the
first option passed to IPython (it will have no effect in any
other position). They provide threading support for the GTK, QT
and WXWidgets toolkits, and for the matplotlib library.
With any of the first four options, IPython starts running a
separate thread for the graphical toolkit's operation, so that
you can open and control graphical elements from within an
IPython command line, without blocking. All four provide
essentially the same functionality, respectively for GTK, QT3,
QT4 and WXWidgets (via their Python interfaces).
Note that with -wthread, you can additionally use the -wxversion
option to request a specific version of wx to be used. This
requires that you have the 'wxversion' Python module installed,
which is part of recent wxPython distributions.
If -pylab is given, IPython loads special support for the mat-
plotlib library (http://matplotlib.sourceforge.net), allowing
interactive usage of any of its backends as defined in the
user's .matplotlibrc file. It automatically activates GTK, QT
or WX threading for IPyhton if the choice of matplotlib backend
requires it. It also modifies the %run command to correctly
execute (without blocking) any matplotlib-based script which
calls show() at the end.
-tk The -g/q/q4/wthread options, and -pylab (if matplotlib is
configured to use GTK, QT or WX), will normally block Tk
graphical interfaces. This means that when GTK, QT or WX
threading is active, any attempt to open a Tk GUI will result in
a dead window, and possibly cause the Python interpreter to
crash. An extra option, -tk, is available to address this
issue. It can ONLY be given as a SECOND option after any of the
above (-gthread, -qthread, q4thread, -wthread or -pylab).
If -tk is given, IPython will try to coordinate Tk threading
with GTK, QT or WX. This is however potentially unreliable, and
you will have to test on your platform and Python configuration
to determine whether it works for you. Debian users have
reported success, apparently due to the fact that Debian builds
all of Tcl, Tk, Tkinter and Python with pthreads support. Under
other Linux environments (such as Fedora Core 2/3), this option
has caused random crashes and lockups of the Python interpreter.
Under other operating systems (Mac OSX and Windows), you'll need
to try it to find out, since currently no user reports are
available.
There is unfortunately no way for IPython to determine at run-
time whether -tk will work reliably or not, so you will need to
do some experiments before relying on it for regular work.
-gthread,-qthread,-q4thread,-wthread,-pylab
其中只有一个可以给出,它只能作为
传递给IPython的第一个选项(它在任何情况下都不起作用
其他职位)。它们为GTK、QT提供线程支持
和WXWidgets工具包,以及matplotlib库。
使用前四个选项中的任何一个,IPython开始运行
为图形工具包的操作分离线程,以便
可以从中打开和控制图形元素
IPython命令行,无阻塞。所有四个都提供
基本相同的功能,分别用于GTK、QT3、,
QT4和WXWidgets(通过它们的Python接口)。
请注意,对于-wthread,还可以使用-wxversion
选项以请求使用特定版本的wx。这
需要安装“wxversion”Python模块,
这是最近wxPython发行版的一部分。
如果给出-pylab,IPython将为垫子加载特殊支撑-
绘图库(http://matplotlib.sourceforge.net),容许
中定义的任何后端的交互使用
用户的.matplotlibrc文件。它会自动激活GTK、QT
如果选择matplotlib后端,则为IPyhton提供WX线程
需要它。它还将%run命令修改为正确
执行(不阻塞)任何基于matplotlib的脚本,该脚本
最后调用show()。
-tk-g/q/q4/wthread选项和-pylab(如果matplotlib是
配置为使用GTK、QT或WX),通常会阻止Tk
图形界面。这意味着当GTK、QT或WX
线程处于活动状态,任何打开Tk GUI的尝试都将导致
一个死窗口,并可能导致Python解释器
崩溃可以使用一个额外的选项-tk来解决这个问题
问题它只能作为以下任一选项之后的第二个选项提供:
以上(-gthread,-qthread,q4thread,-wthread或-pylab)。
如果给出-tk,IPython将尝试协调tk线程
使用GTK、QT或WX。然而,这可能不可靠,并且
您必须在您的平台和Python配置上进行测试
以确定它是否适合您。Debian用户拥有
报告成功,显然是由于Debian构建
所有支持pthreads的Tcl、Tk、Tkinter和Python。在下面
其他Linux环境(如Fedora Core 2/3),此选项
导致Python解释器随机崩溃和锁定。
在其他操作系统(MacOSX和Windows)下,您需要
尝试查找,因为目前没有用户报告
可用。
不幸的是,IPython无法在运行时确定-
时间-tk是否能可靠地工作,所以您需要
在依赖它进行常规工作之前做一些实验。
您是否尝试过使用
-gthread-tk
命令行开关启动ipython
从ipython--help
:
-gthread, -qthread, -q4thread, -wthread, -pylab
Only ONE of these can be given, and it can only be given as the
first option passed to IPython (it will have no effect in any
other position). They provide threading support for the GTK, QT
and WXWidgets toolkits, and for the matplotlib library.
With any of the first four options, IPython starts running a
separate thread for the graphical toolkit's operation, so that
you can open and control graphical elements from within an
IPython command line, without blocking. All four provide
essentially the same functionality, respectively for GTK, QT3,
QT4 and WXWidgets (via their Python interfaces).
Note that with -wthread, you can additionally use the -wxversion
option to request a specific version of wx to be used. This
requires that you have the 'wxversion' Python module installed,
which is part of recent wxPython distributions.
If -pylab is given, IPython loads special support for the mat-
plotlib library (http://matplotlib.sourceforge.net), allowing
interactive usage of any of its backends as defined in the
user's .matplotlibrc file. It automatically activates GTK, QT
or WX threading for IPyhton if the choice of matplotlib backend
requires it. It also modifies the %run command to correctly
execute (without blocking) any matplotlib-based script which
calls show() at the end.
-tk The -g/q/q4/wthread options, and -pylab (if matplotlib is
configured to use GTK, QT or WX), will normally block Tk
graphical interfaces. This means that when GTK, QT or WX
threading is active, any attempt to open a Tk GUI will result in
a dead window, and possibly cause the Python interpreter to
crash. An extra option, -tk, is available to address this
issue. It can ONLY be given as a SECOND option after any of the
above (-gthread, -qthread, q4thread, -wthread or -pylab).
If -tk is given, IPython will try to coordinate Tk threading
with GTK, QT or WX. This is however potentially unreliable, and
you will have to test on your platform and Python configuration
to determine whether it works for you. Debian users have
reported success, apparently due to the fact that Debian builds
all of Tcl, Tk, Tkinter and Python with pthreads support. Under
other Linux environments (such as Fedora Core 2/3), this option
has caused random crashes and lockups of the Python interpreter.
Under other operating systems (Mac OSX and Windows), you'll need
to try it to find out, since currently no user reports are
available.
There is unfortunately no way for IPython to determine at run-
time whether -tk will work reliably or not, so you will need to
do some experiments before relying on it for regular work.
-gthread,-qthread,-q4thread,-wthread,-pylab
其中只有一个可以给出,它只能作为
传递给IPython的第一个选项(它在任何情况下都不起作用
其他职位)。它们为GTK、QT提供线程支持
和WXWidgets工具包,以及matplotlib库。
使用前四个选项中的任何一个,IPython开始运行
为图形工具包的操作分离线程,以便
可以从中打开和控制图形元素
IPython命令行,无阻塞。所有四个都提供
基本相同的功能,分别用于GTK、QT3、,
QT4和WXWidgets(通过它们的Python接口)。
请注意,对于-wthread,还可以使用-wxversion
选项以请求使用特定版本的wx。这
需要安装“wxversion”Python模块,
这是最近wxPython发行版的一部分。
如果给出-pylab,IPython将为垫子加载特殊支撑-
绘图库(http://matplotlib.sourceforge.net),容许
中定义的任何后端的交互使用
用户的.matplotlibrc文件。它会自动激活GTK、QT
如果选择matplotlib后端,则为IPyhton提供WX线程
需要它。它还将%run命令修改为正确
执行(不阻塞)任何基于matplotlib的脚本,该脚本
最后调用show()。
-tk-g/q/q4/wthread选项和-pylab(如果matplotlib是
配置为使用GTK、QT或WX),通常会阻止Tk
图形界面。这意味着当GTK、QT或WX
线程处于活动状态,任何打开Tk GUI的尝试都将导致
一个死窗口,并可能导致Python解释器
cra