Skip to content

tkinter: immediately selecting newly opened window

The code is simple. In tkinter I create a button which opens a new window. The difference in the pictures below might be hard to see but if you look closely you can see that in the first picture the root window is selected even though it’s behind the new opened window. In my actual program I use keybind…

Convert Custom String to Dict

HELLO, I need to convert this kind of string to down dict DICT and i tried this and stored each list with the dict like this but this is not the right way to do it! which brings me lot more errors. So, is there any custom functions or module for these things ? Answer I’d use a regex to

How can I kill a thread with python

I am making a random number guessing game with GUI (Tkinter) and this comes up RuntimeError: threads can only be started once. I’m trying to kill the thread but I can’t find any way. Here’s the code: In the first function (main) is where I call the Thread and in the second function (process)…

Python using Regular Expression to convert a string

I want to convert the duration variable from YouTube Data api? PT1M6S –> 1:06 PT38S –> 0:38 PT58M4 –> 58:04 Here is my codes: p[‘duration’] is the value from json data Is there a simple way to do in one regex statement? Thanks! Answer An alternative to using a regex is u…

dictionary seperation in python

i have a question that might end up being a fairly simple fix but i am having a lot of trouble with it. I am making a program that will allow the user to pick between a list of text files that are all like this to search:mirar,buscar to play:jugar to be:ser,estar to run:correr to make:hacer to talk:hablar to …