I have an application developed in Tkinter and I would like to create a class to get whenever I need a fixed size window with a text box and a button. But I do not know how to do it.
Greetings.
I have an application developed in Tkinter and I would like to create a class to get whenever I need a fixed size window with a text box and a button. But I do not know how to do it.
Greetings.
from tkinter import Tk, Entry, Button, Label
class Ventana():
def __init__(self, x, y, ancho, alto, titulo, texto):
self.ventana = Tk()
self.ventana.geometry(str(ancho)+ "x" + str(alto) + "+" + str(x) + "+" + str(y))
self.ventana.title(str(titulo))
Label(self.ventana, text="Escriba algo:").place(x=5, y=0)
self.txt_texto = Entry(self.ventana).place(x=5, y=25, width=185)
self.btn_boton = Button(self.ventana, text="Miau").place(x=5, y=50, width=185)
if __name__ == "__main__":
v1 = Ventana(450, 300, 200, 90, "#", "Buenos días")
v2 = Ventana(750, 300, 200, 90, "&", "Buenas noches")