Buttons Flickering while using tkinter Mac OS

Viewed 157

I am trying to make a basic GUI using tkinter on Mac

The script runs fine but the button flicker. I have noticed that this flickering seems to be linked with cursor movement. How can I fix this?

I am using Pycharm, Python 3.8

Video of flickering: https://imgur.com/a/wExBaH9

Source code:

from tkinter import *


class Window(Frame):

    def __init__(self, master=None):
        Frame.__init__(self, master)
        self.master = master
        self.pack(fill=BOTH, expand=1)

        exitButton = Button(self, text="Exit", command=self.clickExitButton)
        exitButton.place(x=0, y=0)

        loggerButton = Button(self, text='Run Logger', command=self.clickLoggerButton)
        loggerButton.place(x=100, y=100)

    def clickExitButton(self):
        exit()

    def clickLoggerButton(self):
        print('seen')


root = Tk()
app = Window(root)
root.wm_title("Fard")
root.geometry("500x500")
root.configure(background='red')
root.mainloop()

Edit: I have tested the same code on Repl.it and it worked fine, This makes me think this bug has something to do with rendering the window

1 Answers

can I ask you what version of Mac you are using? I had same problem with python 3.8 that was preinstalled on Mac and then found this. So now I'm using python version 3.9 on Mac Monterey 12.4 and everything seems working correctly. I hope it helps.

Related