GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — OB_curso_de_python/EjerciciosTema10-2 at main · EOM/OB_curso_de_python

Expand file tree

/

EjerciciosTema10-2

/
Copy path

Directory actions

More options

More options

Directory actions

More options

More options

Latest commit

 

History

History
History
/

EjerciciosTema10-2

/
Copy path

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
README.md
README.md
 
 
img.png
img.png
 
 
main.py
main.py
 
 

README.md

Outline

OB Curso de Python

Ejercicio 10.2

Enunciado del ejercicio:

En este segundo ejercicio, tendréis que crear una interfaz sencilla la cual debe de contener una lista de elementos seleccionables, también debe de tener un label con el texto que queráis.

Codigo Python:

from tkinter import (Tk, ttk, Label, Checkbutton, IntVar)


class SimpleGUI(Tk):

    def __init__(self):
        super().__init__()
        self.iniciarUI()

    def iniciarUI(self):
        self.title("Ejercicio 10-2")
        self.minsize(300, 200)  # MIN width, height
        self.maxsize(300, 200)  # MAX width, height
        self.geometry("400x200+550+50")  # centrar ventana
        self.generarWin()

    def generarWin(self):
        tituloLabel = Label(self, text="¿Para que puedo utilizar Phyton?", bd=10)
        tituloLabel.pack(anchor='w')

        # Lista de Checkbutton
        listaDeOpciones = ["Web", "AI", "Services TCP/IP", "Machine Learning"]
        self.listCheck = {}

        # generar todas las lista de opciones en la UI
        for val, txt in enumerate(listaDeOpciones):
            self.listCheck[txt] = Checkbutton(self, text=txt)
            self.listCheck[txt].var = IntVar()
            self.listCheck[txt]['variable'] = self.listCheck[txt].var
            self.listCheck[txt].pack(anchor='w')

        # Boton Reset
        next_button = ttk.Button(self, text="Cerrar", command=self.btnResetear)
        next_button.pack()

    def btnResetear(self):
        self.quit()


if __name__ == "__main__":
    app = SimpleGUI()
    app.mainloop()

Salida:

Print de pantall ejercicio

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.