Mic wrote:
> class SeatButton(tk.Button):
> def __init__(self, master, index):
> text = str(index+1)
> super(SeatButton, self).__init__(master,
> text=text, bg=FREE,
> command=self.clicked)
> self.filename = "Germany_France{}.txt".format(index+1)
> self.occupied = False
> if os.path.exists(self.filename):
> self["bg"]=OCCUPIED
In the above snippet button color and the occupied-flag can get out of sync.
If a seat is occupied the color is correcly updated to red bot the
self.occupied remains False.
A simple fix:
self.occupied = os.path.exists(self.filename)
if self.occupied:
self["bg"] = OCCUPIED
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor