Lets say I have this sample code:
import wx
app = wx.App(False) # Create a new app, don't redirect stdout/stderr to a window.
frame = wx.Frame(None, wx.ID_ANY, "Hello World") # A Frame is a top-level window.
s=wx.Button(frame,-1,"New")
frame.Show(True) # Show the frame.
app.MainLoop()
Like in some programs, if you press the New button, it will open the program again in another window. I am wondering, how can i do this in python?
I cannot make a window object then make copies of it because, in my actual program I am using global variables and these global variables are made for only one window.
It appears that my only option is to find a way to run the program again.
You could try something like this
Which will run python again with the arguments it was run with originally. Or modifying your original example to make pressing the button run the script again :-