Open a window on button click event in wxPython

Hi,
can some one tell me how i must write a program to open a window on button click event.
i have a login window and after i get the user name and password and when i click the login button i should be able to open the main window.can some tell me how i can do this using wxPython.

hi,
i dont want to open a dialog i want to open a window.i have created a separate screen for login and main window . i want to know how to write the code to call the main window?.
can u help me with an example.

If I got it right, you want the login window closed and another window opened if the "login" button is pressed. For this you need to add a button event to the login button (I assume you know how to do it.) In the event function, you can then do something like this:

Code:

# the main module contains the main window
import main
...
class Login(wxFrame):
...
...
def OnLoginButton(self, event):
# check if login is ok
if self.login_ok()
# create the main window
win = main.create(self.GetParent())
# show the main window
win.Show()
# close the login window
self.Close()

# these are our event handlers
def OnLogin(self, event):
if self.OnLogin:
# create the main window
win = mainscreen.Create(self.GetParent())
# show the main window
win.Show()
# close the login window
self.Close()

# these are our event handlers
def OnLogin(self, event):
if self.OnLogin:
# create the main window
win = mainscreen.Create(self.GetParent())
# show the main window
win.Show()
# close the login window
self.Close()

Sorry, I think I was wrong because I assumed that you are using Boa Constructor as a GUI IDE, but apparently you don't. So you could either add a "create" function to the mainscreen module which returns a new window object, e.g.