In a message of Thu, 29 Dec 2005 19:26:00 +0200, Johan Geldenhuys writes:
Marcus,
I tried this
"""
try:
for i in range(tbl_words.rows):
for j in range(tbl_words.columns):
letter = self.letters()
button = Button(letter)
button.border = BORDER_NONE
> button.padding = 0
button.connect_signal(SIG_CLICKED, self.clicked, button, i,
j, letter)
tbl_words.add_child(i, j, button)
self.button_list(i, j, letter)
except:
pass
"""
I am not sure what to put in at the except part. With the above, it
stops as soon as it gets to the first position that is already occupied.
Any ideas what to use there?
I will look at the docs.
Johan
It should look more like this pseudo-code:
already_have_a_letter_waiting = False
for i in range(tbl_words.rows):
for j in range(tbl_words.columns):
if not already_have_a_letter_waiting:
letter = self.letters()
button = Button(letter)
button.border = BORDER_NONE
button.padding = 0
already_have_a_letter_waiting = True:
try:
# here comes the stuff that causes the exception
tbl_words.add_child(i, j, button)
button.connect_signal(SIG_CLICKED, self.clicked, button,
i,j, letter)
self.button_list(i, j, letter)
already_have_a_letter_waiting = False
except PasteInWhateverExceptionYouGetFromYourTraceback:
already_have_a_letter_waiting = True
Laura