Hello,
I am creating a project with wxpython for gui. In one program, I am calling another program, which is executed correctly, but the first one freezes/crashes.
First program: Login.py
Second program: Register.py
Now, when login.py is running, and I call Register.py, Register.py is executed correctly. Now, I want the login window to remain alive, so I am not Destroy()ing it.
But as soon as the Register.py is closed (after successful registration), the Login.py gets freezed and I get the python.exe has stopped working message.
The code for login.py is as attached in loginScreen.py
the code for register is as attached in regi_wit_db.py
(Should I also attach other files as well? There are total 8 .py files used in my project)
I have a welcome screen before the login screen, but it has no problems so far.
Also, when I am calling another screen, mainscreen.py in the code, the login screen is supposed to get destroyed, but Destroy() doesn’t work in this case.
I searched on stackoverflow and some other groups, and I got the idea of using the Datadeck() and run() as in:
def run():
app = DataDeck(1)
app.SetAppName(“LoginScreen”)
app.MainLoop()
class DataDeck(wx.App):
def OnInit(self):
frame=LoginDialog(parent=None,id=-1)
frame.Show()
self.SetTopWindow(frame)
return True
if name == ‘main’:
app=DataDeck()
app.MainLoop()
This works when login is the first screen to be executed and the mainscreen.py is called and executed correctly. But if I call it from welcome.py, the program crashes on every event in mainscreen. No problem for the register screen though.
I thought that maybe the problem would be in how I am calling the different .py files, so I tried using execfile() but it has a completely different way of execution and I had to provide each variable explicitly for every function, even if they belonged to same class.
So I finally settled on import subprocess solution as in the attached files, which works, again, like above run() code: if a program A is run as first executing program, it works, but if the same program A is called from another program B, it crashes after another program C is called from this program A .
There is a similar problem for all my other gui screens as well. In one such screen, i can write data to database successfully, but the application crashes.(when that specific event is triggered)
The frustrating part is that the subprocess solution worked without error when i first tried it, but after 2 days (without even touching the code) the programs have begun crashing
This problem also occurs on another machine too, btw.
Just in case, here are the specs of my machine
OS: Win 8
Python: 2.7
wxpython: 2.7
IDE: IDLE
I am also using some other connectors and libraries for the project, like xgoogle, wikipedia, MySQLdb
I understand that my limited knowledge of wxpython might be the cause, but please guide me where I am going wrong.
Thanks and regards,
Udgam Mehetre
regi_wit_db.py (6.61 KB)
loginScreen.py (2.9 KB)