AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Python tkinter page layers12/13/2023 ![]() ![]() But this is a lot more complicated I think the other solution will probably work a lot better for you. 1 yes you can use canvas.lift (img) or canvas. Mixing waiting on multiprocessing async results with a tkinter event loop is a bit of a pain, but if you use concurrent.futures, you can just attach the create_image as a callback on the Future returned by the task.Ī different option is to have the background processes create off-screen Canvas objects, draw to them, then capture the results as a BitmapImage or a postscript rendering, which you can then pass to the main process to blit onto a Canvas of its own. python - How to update layers of tkinter widgets dynamically - Stack Overflow How to update layers of tkinter widgets dynamically Ask Question Asked 4 years, 8 months ago Modified 4 years, 8 months ago Viewed 1k times -2 Tkinter Requirements So I am relatively new to using tkinter and I am struggling with a very specific doubt here. So the only Canvas command you need is create_image.Īnd, in fact, you can probably do with tasks on a Pool, which just return the image when they're done, with the main process doing the create_image with the results. The simplest solution is to marshal your Canvas commands and pass them over a Pipe or Queue for the main process to execute.Ī fully general solution isn't that hard, but in your case, it should be even simpler: all you want the background process to do is process an image and then display it. CameronLaird calls the yearly decision to keep TkInter 'one of the minor traditions of the Python world.' Tkinter Documentation Python and Tkinter Programming by John Grayson (see also GuiBooks ). It is however the most commonly used one. Tkinter is not the only GuiProgramming toolkit for Python. However, that doesn't mean there's no way to do what you want, just that you can't do it directly. It is a thin object-oriented layer on top of Tcl/Tk. PAGE runs on any system with Python installed and the generated Python code requires only Python to execute. It is a fork or extension of the program Visual Tcl (vTcl) which now produces Python code. ![]() So, the result may be that nothing shows up, that one or both processes freezes, that the GUI doesn't respond to events, that tkinter raises an exception in the child, that tkinter creates a whole separate independent GUI, or, if you're really unlucky, that things unpredictably work sometimes but do one of the other things other times. PAGE is a tool which helps in the creation of Python GUI interfaces using Tkinter and the Tk/ttk widget set. On some platforms, it just isn't possible at all on other platforms, it would be possible, but only by doing things very differently from the way Tk does on others, it sort of works, but the event loops are all screwed up. GUI widgets cannot be shared between processes. ![]()
0 Comments
Read More
Leave a Reply. |