Pyinstaller, NameError: global name 'quit' is not defined

后端 未结 3 496
不知归路
不知归路 2021-01-03 01:39

I have a python script which runs just fine, however after running pyinstaller, I get the following when I use a quit() or exit() command:

相关标签:
3条回答
  • 2021-01-03 01:42

    quit can be found in pygame.locals import *

    Usage:

    for event in pygame.event.get():
        if event.type == QUIT:
            pygame.quit()
            sys.exit()
    
    0 讨论(0)
  • 2021-01-03 02:04

    That is because there is no quit command. You are looking for sys.exit.

    0 讨论(0)
  • 2021-01-03 02:08
    def quit():
        sys.exit()
    
    
    self.quit_button = Button(self, text="QUIT",command = quit)
    
    0 讨论(0)
提交回复
热议问题