I am new to Python and I am stuck with Tkinter. I have a video running in the background, and I need a label to pop up which contains dynamically changing content. I tried it with tkinter and EasyGUI. The contents are getting printed, but it causes my video to pause. I had to close the pop-up each time, for the video to keep running. I guess the tkinter thread is blocking the video playing thread.
Related
I have simple program with only one function which process files and then converts to pdf on a press of button. initially GUI window freezes while the function was running, after this I introduced threading into the program and now GUI freezing issue was resolved, but now when press the button again it shows below error
if anyone can help me on how to fix this and also explain how it works, that will be really helpful, as I am new to python and just started using Tkinter.
sample code would be even more helpful.
You shouldn't use the old thread object you used on the first button click. Instantiate a new one instead.
This is because, you can't start the same thread twice.
So maybe keep a list of threads and add a new one with each button click.
We are now working on a thesis based on drowsiness detection within a car. Our code is on a while loop and every time it detects up to 5 or more seconds to be driver is drowsy, the GUI must show up to alert the user that the car is slowly breaking. My problem is while the opencv webcam is runnning (for the drowsiness detection), the tkinter GUI won't show up. Is there any way to like overlap the tkinter window from the webcam frame running in the background?
Apologies if this has been asked before, but I couldn't find a clear answer. I'm writing a GUI to control a motor from a raspberry pi, and it's on a touchscreen. I've written some code which opens the built in matchbox keyboard when the Entry widget comes into focus, but this halts my entire tkinter window in the background, meaning that the user cannot see what they are entering appear in the Entry until they have closed the keyboard, and also that the screen often tears and looks horrible when it hangs in the background. Is there anyway to run this command:
def createNumpad(event=none):
os.system('matchbox-keyboard numpad')
so that the tkinter window doesn't freeze while the keypad is open? Thanks!
This is the relevant code from a SO answer changed to fit Tkinter:
import subprocess
def createNumpad(event)
try:
subprocess.Popen(["matchbox-keyboard", "numpad"])
except FileNotFoundError:
pass
def deleteNumpad(event):
subprocess.Popen(["killall","matchbox-keyboard"])
#
entry.bind("<Enter>", createNumpad)
entry.bind("<Leave>", deleteNumpad)
I've been working on a media player in python that uses pygame.mixer to play music and PyQt4 to build the UI.
I'm currently using a while loop to check if a song is finished so the next song can be loaded in from the queue. In order to make sure that the user can still interact with the PyQt buttons while the while loop is running, I have put QtCore.QCoreApplication.processEvents() into the while loop.
However, now when I close the main window while music is playing, the program does not stop (as it normally does) and the music keeps playing.
The program also can't detect the app.aboutToQuit.connect() command while the music is playing (meaning it can when music isn't playing).
Any help would be greatly appreciated.
I found the answer to this issue a while ago so thought I should put it here for anyone else.
I gave the program an internal exit button in the ui, then made the button call os._exit(0). It worked perfectly then.
Checking the Python and PyQt documentation gave no comment on closing a application window while a while loop is being performed.
Any other solutions would be appreciated though.
I'm developing a rather big GUI with Tkinter for my cocktail-robot and now I'm trying to disable the mouse for a few seconds, so that no click on the screen will cause any event.
The reason why I need to do this is that the programm crashes if there're to much incoming events. Because I'm using time.sleep() for a few seconds, Windows thinks that the programm crashed and asks whether it should be closed.
Is there any possibilty to do that? Can I just bind the whole screen to "< Button-1 >"
Btw. the GUI is based on this structure:
Switch between two frames in tkinter
I'm looking forward to your help! Thanks