On, Thu Dec 29, 2005, Laura Creighton wrote:
> In a message of Thu, 29 Dec 2005 19:26:00 +0200, Johan Geldenhuys writes:
> >Marcus,
> >I tried this
[...]
> 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
Or the easier way:
for i in range(tbl_words.rows):
for j in range(tbl_words.columns):
if tbl_words.grid[(i, j)] == None:
# Add a child, the table cell is empty.
...
Regards
Marcus
Attachment:
pgptOrZWzaYE3.pgp
Description: PGP signature