You have to start a thread to actually make it do something by calling the start() method, so intuitively you would expect there to be a matching stop() method; but there is no such thing. We'll see how to stop a thread then.
- [Instructor] In the previous video,…we started a thread.…We'll discuss how to stop a thread now.…How you ask?…Well, we will learn how to run a thread…as a background task, which is called a Daemon.…We have to start a thread to actually make it do something…by calling the start method.…So intuitively, we would expect there…to be a matching spot method,…but there is no such thing.…We will learn how to run a thread as a background task,…which is called a Daemon.…
When closing the main thread, which is our GUI,…all Daemons will automatically be stopped as well.…When we call methods in a thread,…we can also pass arguments and keyword arguments…to the method.…Let's do that now.…How to do it?…By adding args= to the thread constructor…and modifying the targeted method to expect arguments.…We could pass arguments to threaded methods.…
The arameter to args has to be a sequence,…so we will wrap our number in a Python list.…Let's modify our code.…Here, runT is a local variable,…which we only access within the scope of the method,…
Note: This course was created by Packt Publishing. We are pleased to host this training in our library.
- Creating buttons and widgets
- Adding labels and features
- Expanding a GUI dynamically
- Aligning frames and embedding frames
- Creating menu bars, message boxes, and tooltips
- Using module-level global variables
- Coding in classes
- Using Matplotlib to create charts
- Working with multiple threads, queues, and TCP/IP
- Using URLOpen to read data from websites
- Localizing a GUI and preparing for internationalization
- Testing a GUI using unit tests and Eclipse PyDev IDE
- Using the wxPython library
- Using Tkinter, PyOpenGL, and Pyglet
Skill Level Intermediate
1. Creating the GUI Form and Adding Widgets
2. Layout Management
3. Look and Feel Customization
4. Data and Classes
Using the StringVar() type8m 14s
5. Matplotlib Charts
6. Threads and Networking
7. Storing Data in Our MySQL Database via Our GUI
8. Internationalization and Testing
9. Extending Our GUI with the wxPython Library
10. Creating Amazing 3D GUIs with PyOpenGL and Pyglet
11. Best Practices
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.