Why isn’t the program closing after the fade animation?

I am new to python and I came up with this idea on how to make the page fade out by controlling the wm_attributes of my GUI program. I made this code which decreases the amount of ‘a’ by 0.1 each iteration then the program goes to sleep for 0.1 second to create this fade effect. After the page was completely transparent I told it to destroy root. However, the fade animation works perfectly but the window freezes and it doesn’t close after the animation is done. What am I doing wrong here? Here is my code: Answer In your

How to make pop-up window with force attention in Tkinter

I want to create a window which doesn’t allow the user to access other windows until you give an input. I tried win.attribute(“ontop”, True) but it allows the user to access other windows. or is there any function like a force_focus_lock() in Tkinter python 3.8 which doesn’t allow other window to get focus until you give a input or the close present window. Answer I believe the below is what you are trying to do. Explanation is given in comments. method #1: (PopOut1) you can still move the main window the new window assumes focus if there is a mouse

How do I change the volume in realtime for my music player (pygame)

I am trying to change the volume of my music in realtime for my music player. My code: And here are the action events: But I don’t know how to change the volume while the music is playing, it only changes the volume after I restart the song. I tried: But that didn’t work it just game me an error. Answer If you don’t use OOP(and I dont think you do based on what you provided), this should be the solution:

tkinter – dock and undock frame with wm_manage and wm_forget

I found the following in the tk docs: The wm manage and wm forget commands may be used to perform undocking and docking of windows. So I tried wm_manage and wm_forget in this code: But it dosen’t worked out. So I readed more and there is no way I can missunderstand this: A toplevel widget may be used as a frame and managed with any of the other geometry managers after using the wm forget command. So I tried to do something like that: But both return None. Am I something missing here? What am I doing wrong? Answer In

Buttons in a for loop to update labels in a for loop?

Trying to get individual buttons to update individual labels in tkinter. Here’s my code: When you run the code there are three buttons in a column next to three labels in the next column over. What I’m trying to do is get it so that each button changes the label next to it. What happens when I run the code is every button modifies the last label and the other two labels are untouched. Any help is awesome, thanks! Answer This will work for you. I don’t think you understand how the buttons work. Once you .grid() them they are

Need help for running tkinter program

I am new to GUI programming so I don’t know why this is not working when I run this program it doesn’t open tkinter window so help me out,this is only running speech recognition program Answer Simply add root.mainloop() at the very end of the script. This is one of the must-haves when you make a script using Tkinter.

Tkinter: keep update a variable

I really need help, my brain is melting because of this problem. I’ve studied python for 2 months maybe and I’m not very expert in programming. I’ve got an issue… I’m using tkinter on this program; in this small GUI I’d like to always keep updated the global variable “temp”, and its value should change everytime I click on the button. I know that mainloop() is a blocking method, so it is possible to do something like this? Thank for the help! Answer If you want to print it in the terminal, modify your getvalue function. Code:

Using Tkinter, Threading and After method

im working on a selenium project using tkinter in python. I want to execute many selenium task at one time(could be up to 100), so I used threading to accomplish this goal, but I came to a problem, due to the fact that I need all individual selenium task to wait a couple seconds between instructions, I used the ‘.after’ method but for some reason my program is still freezing up, I’ve done a lot of research but I cant seem to find the answer yet. Isn’t there a way to use tkinter, threading and some sort of sleeping in

KeyError for multiframe tkinter?

I keep getting a KeyError and I am unsure why. I added a print statement and printed the self.frames dict to ensure that the keys existed, and it appears they do. I’m new to using classes to create multi frame apps so any insight would be helpful. The error: The dict that prints: The code where the error occurs: Answer The keys in your dictionary are the class names, then you’re trying to reference them by the class itself. self.show_frame(StartPage) needs to be self.show_frame(“StartPage”)

Issue with folder path in tkinter (python)

I am having an issue of finding the bug in my code in relation to the folder path using filedialog. I have the following code The following error shows up: Answer To use you have to first create global doesn’t create variable but it is only used in function to inform this function to use external/global variable when you use = to assign value (instead of creating local variable). The same problem you will have with user_input. So you could create variables at start and it resolves problem with these variables EDIT: I found that you use folder_path = StringVar()