Home > Software engineering >  Tkinter Conflicts with Pyautogui
Tkinter Conflicts with Pyautogui

Time:03-26

I was coding on a little puzzle game, where you had to press a button in order to win. enter image description here Level 1:

Whenever your Mouse was on top of the button, the button moved away

Solution: go very near the button and click it, the program wont register it

Level 2: The Button Moved randomly at super high speeds

Solution: Spam Click

I wanted Level 3 to be the final boss, and so that your mouse cursor gets hooked by something, and taken away. So i imported the pyautogui module, but then i had to go, because my mom was screaming that its dinner.

When i came back to coding, and first run the code with pyautogui imported, but no functions of it used, i was surprised. The window size was completely different from that what i set it to. enter image description here

besides that the font was also in a weird way. I checked the code only to see that i put in the right values in self.top.geometry. I was very confused, and searched in the code for functions, that were altering the window size. Nothing. Ive searched for 10 minutes and got really frustrated, changed the editor and tried everything. Then i strategicly undid everything until it worked again. The pyautogui module was it! It was messing with the tkinter module!

Moral of the story: Do not import tkinter and pyautogui at the same time

CodePudding user response:

Post Your project's Code and additional files used in it.

*And please post everything in English

  • Related