Reputation: 839
def run(self, path):
subprocess.call(['pythonw', path])
def login(self):
members = {'sample': 'sample'}
username = self.username.text()
password = self.password.text()
if username in members:
enteredPass = members.get(username)
if password == enteredPass:
self.run('inventory.py')
#app.instance().quit()
sys.exit()
else:
self.username.clear()
self.password.clear()
print("Invalid username and password.")
else:
self.username.clear()
self.password.clear()
print("Invalid username and password.")
I want to close the log-in window after the user enters the correct login details. The window tries to close but freezes and becomes unresponsive.
My problem is how can I close the Log In form without causing it to be unresponsive? (If my code sample is lacking from where you can understand the problem, please tell me. Thank you!)
Upvotes: 0
Views: 54
Reputation: 243887
The call function waits for the return code, so forcing to close the process that launches the new application generates that behavior. You should use Popen
instead of call
.
subprocess.Popen(['pythonw', path])
Upvotes: 1