How to pass variable through scipts

D

dimmaim

My code has this structure:
class Example(wx.Frame,listmix.ColumnSorterMixin):
def __init__(self,parent):
wx.Frame.__init__(self,parent)

self.InitUI()

def InitUI(self):
...... some other functions and other stuff

when a button is clicked this function is called and i take the self.id_number which is a number

def OnB(self, event):
self.id_number = self.text_ctrl_number.GetValue()
xx = latitude[int(self.id_number)]
yy = longitude[int(self.id_number)]

i want to pass the variables xx and yy to a different script called application. This script by calling it with import, automatically pop up a window.. I need by clicking the button that is linked with OnB definition to pop up the window from the other script as it does when i am running it alone and display lets say for example the variables xx and yy, how can i do it
 
C

Chris Angelico

i want to pass the variables xx and yy to a different script called application. This script by calling it with import, automatically pop up a window. I need by clicking the button that is linked with OnB definition to popup the window from the other script as it does when i am running it alone and display lets say for example the variables xx and yy, how can i do it

When you import another script, you gain access to its functions and
classes and such. All you need to do is write your function to take a
couple of arguments, and then pass xx and yy as those arguments.

I recommend you read and work through the Python tutorial - one of
these, depending on which version of Python you use:

https://docs.python.org/2/tutorial/
https://docs.python.org/3/tutorial/

It'll explain a lot of these sorts of things.

Chris Angelico
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top