views:

175

answers:

1

I have one frame where one TextCtrl and a button. I would like to enter a value in that TextCTrl and to be displayed in another frame TextCTrl and use that value for computation in that new frame as well. Any idea would be appreciated.

+1  A: 

Not sure exactly what you want and how you want. if you have two frames in same application , why can't you just copy from one textctrl to other on text change event, or when user presses some button e.g try this example, in this if you type in one frame when will also be displayed in another on wx.EVT_TEXT

import wx

app = wx.PySimpleApp()
frame1 = wx.Frame(None, title="Type Here...", pos=(0,0), size=(300,300))
frame2 = wx.Frame(None, title="...to get value here", pos=(310,0), size=(300,300))

tc1 = wx.TextCtrl(frame1)
tc2 = wx.TextCtrl(frame2)

def textChange(event):
    tc2.SetValue(tc1.GetValue())

tc1.Bind(wx.EVT_TEXT, textChange)

app.SetTopWindow(frame1)
frame1.Show()
frame2.Show()

app.MainLoop()
Anurag Uniyal
To Anurag,Thanks your answer. What i have is a frame with a txtCTrl and a button. When a user enters a number and clicks on the button OK, it will open another frame which has also a TxtCtrl and two buttons.TxtCrtl from the second frame will displayed the number enter from the first frame and I also need to keep that time for a calculation in the second frame. I can capture and displayed it but I am not able to use it for calculation.