2008/05/02

Tkinter

Tcl/TkのTkをPythonから使うようにするのがTkinterです。デモを見るとTcl/Tkと同じことができそうなのですが、ソースを見てみると、何となくいやな予感が。
一番簡単なサンプルだとこんな感じなのですが、最後の文が無限ループなので、これよりプログラムを先に進めることができません。

from Tkinter import *
root = Tk()
w=Label(root, text="Hello, world!")
w.pack()
root.mainloop()

Tkを抜けた時点でOpenGLの
glutMainLoop()
が走り出すので、ここを何とかしないといけないですね。初心者のレベルを超えた難題ですので、とりあえずTkinterは棚上げにしたいと思います。

Both Tkinter and OpenGL have main loop. Because those are infinite loop, I should exit the first loop before starting the second loop. This is a very difficult problem I shouldn't spend time at this point.

0 件のコメント: