Thanks for the tutorials, I have bought the book and this will be good to look at for reference as a code in PyQT5.
@joshuakornblum63414 жыл бұрын
The Norm McDonald of Python GUI coding! Love it.
@xllvr4 жыл бұрын
This and the analogies within helped a lot with understanding threading better. It's quite difficult to wrap your mind around the concept and how it's implemented, but this helped to clarify quite a bit which I needed for a major project.
@DA_CSF2 жыл бұрын
Thanks for the explanation. I came in time before I was about to give up and accept a freezing GUI. If only I had stubbled on this earlier, might have saved a ton of time.
@Soljarag54 жыл бұрын
whooohoo! I got threads working in my project! Thanks man!!!
@Lucas-br3fn3 жыл бұрын
Man, i'm new to python and you helped me SO much! Ty mate, keep the great work
@codenio4 жыл бұрын
Thanks for this wonder tutorial series. How could we stop QThread safely from GUI on demand?
@Shizostereo4 жыл бұрын
Up this question
@beaujamie26613 жыл бұрын
a tip: you can watch series on Flixzone. I've been using them for watching lots of of movies during the lockdown.
@tonyfox13163 жыл бұрын
@Beau Jamie Yea, been using Flixzone} for since november myself :D
@aneesch69084 жыл бұрын
Thanks for your lesson it's really helpful and very easy to follow you, awesome 10/10
@Grlypyt4 жыл бұрын
Great video, super helpful thanks for your hard work in making this!
@alandmoorecodes35854 жыл бұрын
Thanks!
@weekendprogrammer75454 жыл бұрын
Your way of teaching is dam good, best programming video explanation I have seen. That too on threads. Amazing sir, I'm looking forward to buying your book. Please continue doing video on pyqt. I'm a freelancer and this particular video helped me through threading, and also your signals ans slots video. Thank you for your videos.
@alandmoorecodes35854 жыл бұрын
Thanks! Hope the book helps too.
@ak47-hz4fq4np3zАй бұрын
Thanks a million man, great video!
@VAN_production.mp43 жыл бұрын
That story time got me 😄😄😄😄😄 subscribed just because of it! 😂😂
@alandmoorecodes35853 жыл бұрын
Thanks!
@pabloparada6363 жыл бұрын
So very well explained! you didn't miss a beat in the whole video; please go into teaching :)
@mahmoudali16603 жыл бұрын
Thank you so much! You’ve helped me a lot❤️
@mohamedsaidi53754 жыл бұрын
Hey Man thinks to you I learned , many PyQt concepts in no time. keep up !
@alandmoorecodes35854 жыл бұрын
Thanks!
@johnnytoobad77853 жыл бұрын
I recently implemented a Prod-Cons (I/O bound) thread pool using Python threading and tkinter (using "after"). The tk version seems simpler but not as versatile since tk is not "thread aware". Basically I just used ".after" in tk as a timer-interrupt to launch and monitor the back-end threads. Eventually I would like to translate that app to Qt5. I love the "Mr 5-bags" analogy.
@Soljarag54 жыл бұрын
ha, this is pretty much exactly what I needed... thanks!!!!!!
@PythonisLove4 жыл бұрын
Thanks for the video...
@thghtfl4 жыл бұрын
this is just brilliant
@siddharthchabukswar24 жыл бұрын
Hi! Great tutorial, explained the concepts quite well. The Worker threads are not terminating after exiting the main window(By Clicking the 'X'). The Console says 'QThread: Destroyed while thread is still running'. Please help.
@ShnitzenGiggles4 жыл бұрын
Hey man, just want to say your vids are extremely helpful, the metaphor was supremely welcome, can't stand "Mr. 5 Carts". With that, if I could make a request. The internet is throughout lacking for people who have a hard time sifting through documentation and stack overflow posts that go off on a tangent or are titled ambiguously and the body is too specific. One thing that I've been doing, and using your videos, I've been piecing things together. I've only been programming since may and I've become a little ambitious. However, I'm not letting the wall of plethora of knowledge stand in my way. Though I lack some crucial and fundamental things. Software engineering and application engineering best practices. Incorporating design patterns into a gui application. The dos and don't's if you will. If a very basic theory crafted video (I know very conflicting ideas) were to be made that outlines how one should approach a multievent and multitasked application I'd venture to say it would be a boon to those who have taken on programming to enhance their current career, such as myself being a network engineer. Qthreading is something I've taken on, though I'm experiencing some things that I don't know if it's something I'm doing or just an inherent problem (lag in the gui, not locking up, when I run a background task that doesn't require sending data back to the gui.
@rebelScience4 жыл бұрын
Awesome video. I am wondering if I should use PyQT or PySide2. Can' find a definitive answer online. I am developing (adding a UI to my huge set of Bioinformatics classes) a tool and it will be 100% free and open-source.
@alandmoorecodes35854 жыл бұрын
Well, I have to admit I'm a bit biased towards PyQt. Functionally, it makes very little difference. There are few differences in the code, and in fact I've made projects that supported both. I will say in PyQt's favor that it has been steadily turning out releases for over 13 years, whereas the PySide project died out for several years before being recently revived. So I'm a little leery about trusting its longevity. To be fair, I'm not sure how many people apart from Phil Thompson actually develop PyQt, so there's maybe a bus factor involved there (I may be wrong). Speculations aside, the biggest difference right now is licensing, which is moot in your case.
@tom_p64303 жыл бұрын
Great video. I have a specific question, maybe you will take the time to answer here. Let's say I have a main window and I want to write a function that do things. But that function at some point needs input from the user, and this input is asked in the form of a setting window where numerical fields have to be filled. My question is: how to make the function wait for the setting window to be close (meaning that the numerical values are submitted). The only way I could come up with is to split my function in two functions, and play with signals and slots to first emit a signal at the end of the first function to open the setting window, that itself emit a signal upon closing for processing the second function with the values submitted. I am certain there is a better way of doing that. Thank you.
@alandmoorecodes35853 жыл бұрын
Offhand i feel like you're on the right track there. Signals and slots are the most appropriate way to communicate between your backend and a pyqt gui.
@tom_p64303 жыл бұрын
@@alandmoorecodes3585 Thanks. Now that I went this way, my code looks more modular, and I can reuse the individual split functions for different purposes.
@johanocop4 жыл бұрын
Hi Alan, I bought a few books about PyQt5, and yours is by far the on that I got the best understanding from, so a big thanks for your good work.. I have two question regarding Qthread that I hope you can help me with. I have made a program with 10 threads, each thread updates different locations in a Qtable at 10Hz in the main GUI(it works but I use python thread) I need an example of how to make multiple Qthreads, I cant figure out if I need one "worker" for each "worker_thread" and is each of my 10 Objects(that needs to run individual) actually the "worker" ?
@alandmoorecodes35854 жыл бұрын
That might be a good case QRunnable workers controlled by a QThreadPool. Then have a single QThread that manages those and communicates updates the GUI. Hard to say without knowing more about the code. You may have trouble keeping it realtime at 10Hz.
@ryadorexy3 жыл бұрын
I tried the code but AttributeError: 'PyQt5.QtCore.pyqtSignal' object has no attribute 'emit', can anyone help with this?
@alandmoorecodes35853 жыл бұрын
IIRC, for some reason emit does not exist until a signal has been bound to something. You just need to make sure to connect the signal before referencing emit.
@billcolak52533 жыл бұрын
skip to 21:30 to get to the point.
@thestigster4 жыл бұрын
I have a question about the worker class: You construct it as a QObject; why not as a QRunnable? What is the difference between the two? (I am very much a PyQt5-apprentice trying to understand this mighty powerhouse.)
@alandmoorecodes35854 жыл бұрын
QRunnable isn't able to send signals; they're more useful in a high-concurrency situation where you want to distribute a load among a lot of workers. If you just have one process that needs to run independently of the GUI, a QObject moved to a different thread is simpler, since we can use signals and slots to communicate with it.
@thestigster4 жыл бұрын
Alan D Moore Codes Aha! I see. Sounds like more of a ”fire and forget”-ish thing. Thanks for the swift reply, by the way. This was very helpful.
@TheTrainWatch3 жыл бұрын
@@alandmoorecodes3585 what about inheriting from QThread? I’ve seen someone do that before and it didn’t need the move to thread call and signals and slots worked.
@saidshaban3894 жыл бұрын
Hey! Thank you very much for your videos, they're a great help for newcomers! I have a rather tricky question, I hope you can help me with! I am trying to do realtime data in my GUI from data I collect from another thread. How am i supposed to do that? I have been working on Qobjects and Qthreads, but they do not seem to be the solution.
@alandmoorecodes35854 жыл бұрын
Without knowing more about why QObjects and QThreads didn't work for you, it's hard to say. They can definitely be difficult to work with, though.
@neobyte9994 жыл бұрын
I'm confused about the hash_gen = recursive_hashes(Path(root)). How is that utilizing the recursive_hashes function above? To be specific, I'm pointing more towards the "Path(root)" portion of it. What does that mean?
@alandmoorecodes35854 жыл бұрын
Because it uses yield rather than return, recursive_hashes() returns a generator. Hard to explain generators in a single comment, maybe start here: wiki.python.org/moin/Generators
@alandmoorecodes35854 жыл бұрын
What PyQt topics do you want next? Let me know here!
@haydenhoodless20554 жыл бұрын
Event handlers in PyQT. mousePressEvent, mouseMoveEvent etc.
@cro93644 жыл бұрын
could you show us how to structure our projects
@NphiniT4 жыл бұрын
Connecting to and interacting with Databases (MySQL or similar)
@hackpiece30944 жыл бұрын
Sir can you please guide me over a threading issue? I have a main widget with a Find button and a QtableWidget. I want to traverse a given directory path And make corresponding Qwidgets from that path to be shown in QtableWidget. I am following the way its recommended to use threads...ie. Using generator to traverse subdirectory and emiting signals from a worker thread and connecting slots to the mainWidget as you too have done. However due to the Qwidget creation in the main widget for each time the signal is emited by the worker thread for the purpose of adding the qwidget to the QtableWidget, the Gui Freezes. I guess the rate of emitting the signals from the worker thread is higher than the rate at which the main Qwidget is making the sub- widgets and adding them to the QtableWidget as using sleep for 1 sec after emiting the signal has prevented the gui being frozen. I would like a more event driven approach... something like the signal once emited should wait until its corresponding slot has completed its job.Only then should it be emiting another signal.
@alandmoorecodes35854 жыл бұрын
If you want one thread to wait on the other, it seems to me that doesn't really make sense to use threads. You would be better off just calling your generator's next value, then creating the widget, all in the main thread, would you not?
@hackpiece30944 жыл бұрын
@@alandmoorecodes3585 Hi Sir , I did that previously but the Gui was freezing...However I solved the mess by using other thread to get emit me a signal along with the details from a generator with next. I then made an object, added to the table and again requested the thread to emit me another signal along with the details. On StopIteraton exception, the thread emits a stop signal and i show the table. I am using thread because before getting the details, i am performing a lengthy check over each path...That was making the Gui Sluggish. Thank You So much for getting time out of your day to reply.
@bennguyen13134 жыл бұрын
I've run into a situation where I need to update my MainWindow's gui elements (label, etc), from another class (thread). Is there a pythonic way to get access to the gui objects in another class?
@alandmoorecodes35854 жыл бұрын
Generally, you don't want to do that. What you should do instead is use signals and slots to trigger class methods that manipulate the classes's gui elements.
@Soljarag54 жыл бұрын
@@alandmoorecodes3585 hmmm.. I guess i should change my "MainWindow.statusbar.showMessage(filename) " to a signal/slot?