Strange problem!

Hello everyone!

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()

def run():
app = login(1)
app.SetAppName(“Login”)
app.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!

Thanks,
Udgam

By the way, each program runs perfectly on its own and also opens the program after it…just that it doesnt open the one before it…

Hi,

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.

  • Mike

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:)"

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.

···

--
View this message in context: http://wxpython-users.1045709.n5.nabble.com/Strange-problem-tp5714829p5714837.html
Sent from the wxPython-users mailing list archive at Nabble.com.

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.

···

On 10/2/12 12:47 PM, Udgam Mehetre wrote:

Hello everyone!

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...

--
Robin Dunn
Software Craftsman

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:)"