Hello, I am working on a project, and I cant seem to get around a part of it, which is really crucial to the program.. I am using WX btw for GUI, but unfortunately, I want when a button clicked, to open a new Miniframe and take the values and use them in the main Frame which is in another class...

Is there a way to have multiple miniframes under one class, or a way to return the variables from a class to another for example:

class window():
     def main():
          x=10
          return x

class frame():
     def fn():

I want to use the "x" in window in the "fn"....
Please help project deadline is so near...

Generally speaking you open a new frame, not a new mainframe. There is no way to tell how the class is called from the sample, but you would access variables the same way as with any other class.

##--- Not tested
class Window_Test():
     def __init__(self):
          x=10
          ## instance of the class
          fr = Frame_Test()
          ## call the function
          y = fr.fn(x)
          print "y =", y
          print fr.var
          return x

class Frame_Test():
     def __init__(self):
         self.var = "class Frame_Test variable"

     def fn(self, x):
         print "fn called -->", x
         return x + 1

W=Window_Test()

Woooee well said!

Thank you so much i will study that code a while :D

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.