hi!
i wrote a program that uses varius frames defined in clases and now i need to be able to call variables to be imported outside the classes.
if for example a definided a crttexbox in frame1 that thakes a variable
and i need to import that variable to another crttexbox in frame2 (frame 2) is defined in another class
in general how can i declare variables valid anywhere in programs that keep calling eachother???
how can i do this???
Well, I’m pretty inexpert, but I’ll give it a shot. If I understand you correctly, you would use dot notation. Example:
Let’s say you have two modules, Module1 and Module2, each which has a wxFrame, Frame1 and Frame2. Each frame then also has a text control, textCtrl1 and textCtrl2. Frame1 is the main frame of the application. So to pass the value of textCtrl1 into textCtrl2 (even though it’s in another frame which is in another module), do this:
import Module2
text = self.textCtrl1.GetValue()
Frame2 = Module2.Frame2(None)
Frame2.Show()
Frame2.textCtrl1.SetValue(text)
You can cause this getting and setting of the text by the user pushing a button or a text event or whatever, and putting this code under that event handler.
hi!
i wrote a program that uses varius frames defined in clases and now i need to be able to call variables to be imported outside the classes.
if for example a definided a crttexbox in frame1 that thakes a variable
and i need to import that variable to another crttexbox in frame2 (frame 2) is defined in another class
in general how can i declare variables valid anywhere in programs that keep calling eachother???
how can i do this???