python tkinter overrideredirect; cannot receive keystrokes (Linux)

前端 未结 2 1825
悲哀的现实
悲哀的现实 2020-12-06 14:25

I have a python tkinter application which I want to run full screen. When I uncomment overrideredirect, the window manager (Gnome, Linux) will not be able to forward keystro

相关标签:
2条回答
  • 2020-12-06 14:50

    This works for the use case where you're using overrideredirect to get fullscreen, which is somewhat common:

    #self.root.overrideredirect(1)
    self.root.attributes('-fullscreen', True)
    
    0 讨论(0)
  • 2020-12-06 15:10

    You might want to enter the callable self.root.quit instead of self.root.quit() when you do the binding to avoid calling the function. when you will press Escape the callable will be called (I know I know) with an event argument. If self.root.quit() does not accept any argument: use lambda: self.root.bind('<Escape>',lambda e:self.root.quit())

    0 讨论(0)
提交回复
热议问题