开发者

Does Jython support Tkinter

Does Jython support Tkinter ? If I code a program in Python and put a GUI front end on it with Tkinter, how hard would it be to do the same program in Jython? Or is there a better solution for Jython GUI's?

When i try java -jar "jarname" It is showing error as : import Tkinter, tkFileDialog, tkMessageBox, tempfile, shutil ImportError: No module named Tkinter

How can i r开发者_StackOverflow中文版esolve this............ Thanks in advance.....:)


No, it does not. You'll have to rewrite your application using swt, swing, etc. There is no Jython-CPython compatible gui, unless you are coding for the web.


There exists an ancient (last modified 2000-01-30) project to run Tkinter on Jython (then JPython) using the Java Native Interface: JTkinter. I would be shocked if it still works with a modern JVM and Jython, but for anyone interested in porting Tkinter looking at its code would be a good starting point.


The JyNI project aims to support native CPython extensions in Jython. Although it is still far from being mature, especially Tkinter is already said to be supported. However JyNI currently only works on linux. In its current version, JyNI does no garbage collection, so might leak memory. However, I suppose this should be not much of an issue for Tkinter, but it should still be used with care.

Just by chance - if you should try it despite these drawbacks: Since I am involved in this project, I would appreciate if you could give feedback to the project's contact email and - if it should fail on your Tkinter code - send the failing Tkinter-code snippet.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜