Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dynamic button text
#1
hi I am putting some code together that uses a pickle file that saves my data from previous session. I have a set up page that allows the users to change the text on the buttons but I am having way to much trouble trying to get the buttons to update using a textvariable and been on the google all day almost

Hope some one can point me in the right direction please.

self.MyList = loaddata()
        print(self.MyList)

        self.text1=((self.MyList[4]))
        print(self.text1)


   



        self.button1 = tk.Button(self.frame, textvariable  = self.text1, width = 25, command=self.capture_asset)
        self.button1.grid(row=2, column=3) 
Mylist comes from the pickle file when I print self.text1 is fine and shows the text string I want to put on the button but the button shows a blank text?
Reply


Messages In This Thread
Dynamic button text - by Philbot - Jan-07-2018, 09:51 PM
RE: Dynamic button text - by Gribouillis - Jan-07-2018, 10:39 PM
RE: Dynamic button text - by Philbot - Jan-07-2018, 10:51 PM
RE: Dynamic button text - by Gribouillis - Jan-07-2018, 10:59 PM
RE: Dynamic button text - by Philbot - Jan-08-2018, 07:45 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Start print a text after open an async task via button Nietzsche 0 735 May-15-2023, 06:52 AM
Last Post: Nietzsche
  Change the text in the button object chris0147 1 2,913 Sep-02-2017, 04:40 AM
Last Post: kalyanben

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020