rectangletangle
rectangletangle

Reputation: 53031

change the label of the radiobutton

I'm creating a menu in Tkinter. After my menu has been created I'd like to be able to change the label of the radiobutton. Something similar to the .configure method. How do I go about this?

I want to be able to change the radiobuttons text from "Hello" to "Hello!".

Snippet:

    self.B3Me = Tkinter.Menu(self, tearoff=0,
                                activebackground='grey15',
                                activeforeground='grey95')
    self.B3MeVar = Tkinter.StringVar()
    self.B3Me.add_radiobutton(label='Hello', variable=self.B3MeVar,
                                 command=self.B3_menu_beh)

Upvotes: 0

Views: 648

Answers (1)

Bryan Oakley
Bryan Oakley

Reputation: 386332

To modify the label use the entryconfig method. You give this method an index which can be the integer position of the item, or the label itself. For example:

self.B3Me.entryconfig("Hello", label="Goodbye!")

Upvotes: 1

Related Questions