faqts : Computers : Programming : Languages : Python : Tkinter

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

0 of 1 people (0%) answered Yes
Recently 0 of 1 people (0%) answered Yes

Entry

How do I retrieve the contents of a Button's text field to use for a conditional statement?

Mar 22nd, 2006 22:07
Waldi Wolf, Moo Master,


from Tkinter import *
.
.
.


def click(ptr):
   txt = ptr.widget['text']
   if txt == 'Close':
      .........

   .
   .
   .
   bt=Button(parent, text='Close',......)
   bt.bind('<Button-1>',click)
   bt.pack()   # or whatever