简体   繁体   中英

Tkinter multiple tabs: (Multithreading or Multiprocessing)

I am building a tkinter gui program with multiple tabs and perform object detection in each tab. I just wonder shall I use multiprocessing for each tab like Google Chrome or just use multithreading. Which design would be better in term of performance in this context?

You can use whatever you want for worker threads , but only a single thread (the "GUI thread") can actually draw things on the screen.

That's how it happens in browsers, too -- slave processes basically render pages in memory and send pixel data to the master process that draws them; the master process sends back user input and such.

Rendering standard GUI elements in memory isn't possible for most stock GUI toolkits, including Tk ('cuz it's an uncommon requirement) so you can't do that. It is typically possible at windowing system level (eg in Windows, it's via MemoryDC ) which is what browsers take advantage of.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM