Embedding turtle graphics in Pyqt5 interface

流过昼夜 提交于 2020-06-23 15:59:25

问题


I'm trying to make GUI in pyqt5 with only a button and a simple recursive drawing

what're the ideal tools for this task? I tried Turtle which is simple and get the job done but I don't know how to embed the graphics inside pyqt it opens a different window


回答1:


turtle is built on top of tkinter. tkinter and pyqt5 each use their own event loop. I don't think it is possible (or at least, it wouldn't be very easy) to mix two different GUI toolkits (tkinter and pyqt5) in one app.

If you want to use turtle, you should build the GUI with tkinter and embed a RawTurtle in a canvas.

Or, alternatively, build the GUI with pyqt5, and make the drawing with, perhaps, a QPen.



来源:https://stackoverflow.com/questions/53518509/embedding-turtle-graphics-in-pyqt5-interface

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!