Hello.

I can't figure out what's wrong in here! For some reason I can't understand, the radiobuttons don't work. The code itself is correct, the problem arises when I tell them that their master is self.configurar. I don't know why, but they don't like it.

Any help is welcome
Thanks
Ismael

   def _configurar(self):
       self.configurar = Tk()
       self.configurar.title("Configurar")

       self.opciones = []
       textos = ["Tamaņo vertical", "Tamaņo horizontal", "Tamaņo botones"]
       valores = [self.x, self.y, self.tama]
       for i in range(3):
           Label(self.configurar, text=textos[i]).grid(row =i, column = 0)
           entr= Entry(self.configurar)
           entr.grid(row = i, column = 1)
           entr.insert(0, valores[i])
           self.opciones.append(entr)

self.valor = StringVar()
self.valor.set('pibe')
#### Here
self.H = Radiobutton(self.configurar, text="Hombre", variable=self.valor, value='pibe')
self.H.grid(row=3, column=0)
self.M = Radiobutton(self.configurar, text="Mujer", variable=self.valor, value='piba')
self.M.grid(row=3, column=1)


       if self.mensaje == "pibe":
           self.H.select()
       else:
           self.M.select()

Button(self.configurar, command=lambda: self._configurarOk(), text="Ok").grid(row=4, column=0 )
Button(self.configurar, command=lambda: self.configurar.destroy(), text="Cancelar").grid(row=4, column=1)


   def _configurarOk(self):

       for i in range(self.x):
           for j in range(self.y):
               self.botones[i][j].destroy()
       self.salir.destroy()
       self.rein.destroy()

self.mensaje = self.valor.get()
print self.mensaje
self.x = int(self.opciones[0].get())
self.y = int(self.opciones[1].get())
self.tama = int(self.opciones[2].get())
self._crearBotones()


       self.lights.x = self.x
       self.lights.y = self.y
       self.lights._hacerTablero()
       self.lights._llenarTablero()

self._updateBotones()
self.configurar.destroy()
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to