The problem I m having, I m not sure if its related to python, wxpython, mysqldb or just me.. Here is what happens: I open the welcome screen of my project, which opens a login page, which again opens a homepage..
On login page , i have a button event to open the welcome page again..
The respective linking works fine when I start from welcome page.. However, if I start from between, i.e login page, then my program just refuses to open the welcome page..
The same thing happens for other files as well, i.e the previous programs are not opened if I run a program after it Note that this before-after sequence is what I have set...
The code I use for opening a new file is: def GoToLogin(self, event): self.Close() import login login.run() event.Skip()
run function in login is as follows:
class login(wx.App): def OnInit(self): frame = MyLogin(None) frame.Show() return True
# end of class MyLogin
if __name__ == "__main__": Login = MyLogin2(0) Login.MainLoop()
Is the problem in programming or in the implementation of such a logic? Oh, just in case u were wondering, My project uses MySQL to maintain a database.. Plz help!
What I do when I need to have a login dialog before the main app loads is something like this:
1) In my main frame's init, I load a login dialog and show it modally. This causes any following code to be "paused" so the main app doesn't load unless the user enters the correct credentials. 2) If the right credentials are entered, then you destroy the dialog and the code continues to load the main frame (i.e. welcome page)
I have an example somewhere at home. I should put that on my blog sometime.
I know what u mean...but what i am doing is not just opening login from
welcome, but opening welcome after a page which is after login..
In short, after logout, again welcome should open...
And it runs very well if I start from welcome initially...just doesnt work
if i start from login..
-- *Udgam Mehetre*
*
*
*" **Cause Laughter Is The Best Medicine** :)"*
> The problem I m having, I m not sure if its related to python, wxpython,
> mysqldb or just me..
> Here is what happens:
> I open the welcome screen of my project, which opens a login page, which
> again opens a homepage..
> On login page , i have a button event to open the welcome page again..
> The respective linking works fine when I start from welcome page..
> However, if I start from between, i.e login page, then my program just
> refuses to open the welcome page..
> The same thing happens for other files as well, i.e the previous
> programs are not opened if I run a program after it
> Note that this before-after sequence is what I have set...
Rather than making them all be standalone applications, you should instead have just one wx.App instance for the whole program and simply create and show the frames or dialogs as appropriate when they are needed.
>Rather than making them all be standalone applications, you should
instead have just one
>wx.App instance for the whole program and simply create and show the
frames or dialogs as
>appropriate when they are needed.
Yes,you are right..
By the time I got the problem, I was very much into the hole to combine
them all together..
...Maybe I was lazy:p
But anyway, why does it happen? That was my initial question..so that I may
understand a bit more of the working of my code...
-- *Udgam Mehetre*
*
*
*" **Cause Laughter Is The Best Medicine** :)"*
You should call MainLoop() once in the whole program. Don't initialize
another wxApp but just directly create one or more new loggin frames
simultaneously. Remeber each frame's handle, and then, you can switch over
them without any trouble.