consumer got =[producer id= count= consumer got =[producer id= count= consumer got =[producer id= count= consumer got =[producer id= count= consumer got =[producer id= count= consumer got =[producer id= count= main thread exit try adjusting the parameters at the top of this script to experiment with different scenarios single consumerfor instancewould simulate gui' main thread here is the output of single-consumer run--producers still add to the queue in fairly random fashionbecause threads run in parallel with each other and with the consumerc:\pp \system\threadsqueuetest py consumer got =[producer id= count= consumer got =[producer id= count= consumer got =[producer id= count= consumer got =[producer id= count= consumer got =[producer id= count= consumer got =[producer id= count= consumer got =[producer id= count= consumer got =[producer id= count= consumer got =[producer id= count= consumer got =[producer id= count= consumer got =[producer id= count= consumer got =[producer id= count= consumer got =[producer id= count= consumer got =[producer id= count= consumer got =[producer id= count= consumer got =[producer id= count= main thread exit in addition to the basics used in our scriptqueues may be fixed or infinite in sizeand get and put calls may or may not blocksee the python library manual for more details on queue interface options since we just simulated typical gui structurethoughlet' explore the notion bit further previewguis and threads we will return to threads and queues and see additional thread and queue examples when we study guis later in this book the pymailgui example in for instancewill make extensive use of thread and queue tools introduced here and developed further in and will discuss threading in the context of the tkinter gui toolkit once we've had chance to study it although we can' get into code at this pointthreads are usually an integral part of most nontrivial guis in factthe activity model of many guis is combination of threadsa queueand timerbased loop here' why in the context of guiany operation that can block or take long time to complete must be spawned off to run in parallel so that the gui (the main thread parallel system tools