Curso de python - Create desktop applications with Python tkinter

 

Create desktop applications with Python tkinter

tkinter
from tkinter import *class OnOffButton(Button):
def __init__(self,master=None,text=None):
Button.__init__(self,master,text=text)
self['command'] = self._onButtonClick
def _onButtonClick(self):
print('button clicked')
class App(Frame):
def __init__(self,master=None):
Frame.__init__(self,master)
self.labelHello = Label(self,text="Hello World")
self.labelHello['fg'] = "red"
self.labelHello.grid()
self.button1 = OnOffButton(self,text="Click Me")
self.button1.grid()
self.button2 = OnOffButton(self,text="Click me?")
self.button2.grid()
def main():
root = Tk()
app = App(master=root)
app.grid()
root.mainloop()
if __name__ == '__main__':
main()
Label(self,text="Hello World")
Button(self,text="Click me?")
SHARE

Oscar perez

Arquitecto especialista en gestion de proyectos si necesitas desarrollar algun proyecto en Bogota contactame en el 3006825874 o visita mi pagina en www.arquitectobogota.tk

  • Image
  • Image
  • Image
  • Image
  • Image
    Blogger Comment
    Facebook Comment

0 comentarios:

Publicar un comentario