arrays of tkinter buttons

Karthik Gurumurthy karthikg at aztec.soft.net
Thu Aug 23 03:17:11 EDT 2001


am also new in the python world but hope this helps:
say for array of 3 buttons.

titles = ['Submit','Open','Cancel']
buttons = []
for title in titles:
	buttons.append(Button(parent,text= title,command=<some function/method
object>)

as long as the command is associated with the same function/method callback
object it s'd be fine.

karthik.




-----Original Message-----
From: python-list-admin at python.org
[mailto:python-list-admin at python.org]On Behalf Of Locke
Sent: Thursday, August 23, 2001 11:48 AM
To: python-list at python.org
Subject: arrays of tkinter buttons


Is there a way to make an array of tkinter buttons? In visual basic you can
do this cool there where you can have an array of buttons, and you can have
them all call the same function, but have one of its arguments be
the index of the button clicked in the array.

Does python even have normal arrays, or do you have to use lists?

How could i create an array of several buttons? Would I need to use a loop?

Thanks a lot for any help people!

--
http://mail.python.org/mailman/listinfo/python-list




More information about the Python-list mailing list