0

I want to collect input from the user in test box. So when I click a button it should give me name of that button in test box Error: you should omit either rows of column

   for i in A:


        hbox1=wx.BoxSizer(wx.HORIZONTAL)



        btn = wx.Button(p, -1, i, (10,20)) 


        btn.myname = I


        gs.Add(btn,0,)


        self.Bind(wx.EVT_BUTTON, self.OnClick, btn)


        self.t1=wx.TextCtrl(p)


        gs.Add(btn,0,)    


        self.t1.Bind(wx.EVT_BUTTON, self.OnClick, btn)


        gs.Add(hbox1)

    p.SetSizer(gs)


def OnClick(self, event):  #When the button is clicked

    name = event.GetEventObject().myname

1 Answer 1

2

Use wx.TextCtrl: self.t1=wx.TextCtrl(p)

Sign up to request clarification or add additional context in comments.

6 Comments

and btn.myname = i not btn.myname = I
@phd still getting error: may be you should omit the number of rows or columns. Failed at Do insert(): too many items (181> 18*11). My grid has 18 columns and 11 rows.
@HimanshuPareek That code is not even in the question please read and digest stackoverflow.com/help/mcve and stackoverflow.com/tour
@Rolf of sexony I am running this code in my python 2.7 . I want to collect input from user (when user will click the buttpn) in test box. I have used on click method with txtctrl not sure whether this syntax is right ?
@HimanshuPareek Look at your original question stackoverflow.com/questions/44306457/…
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.