Home > other >  When Python3 Tkinter inside the button, and then click the button to display the text as a parameter
When Python3 Tkinter inside the button, and then click the button to display the text as a parameter

Time:11-21

Arrcommand [I]. Append (Button (self, text=arr [I] [n]))
Arrcommand [I] [n]. The grid (row=I + 2, the column=n, columnspan=2 if I!=0 and n==3 else 1, sticky=NSEW)
Arrcommand [I] [n]. [" command "]=self SSSS (t= arrcommand [I] [n] [" text "])
There I use temporary variables instead of a moment, I put a row of buttons in an array, and all buttons need to do the same, but need button to display the text, and the question now is whether the program dynamic invocation button, don't know what button text property is, I now want to with what method to replace the red part, make the program at any time click the button, the button to show the text as a parameter to the method of SSSS, click on the button to get the array subscript I, n. Or get program which button click and then call "text" can be,

CodePudding user response:

Arrcommand [I] [n] [" command "]=lambda m=arrcommand [I] [n] [" text "] : v1. Set (v1. The get () + m)
  • Related