Custom window other than standard in python

Asked

Viewed 1,015 times

2

hi, I would like an example of Python window, different from the pattern, as I do it ???

this is my code:

from tkinter import = 
root = Tk()
theLabel = Label(root, text="This is too easy")
theLabel.pack()
root.mainloop()

1 answer

1


I’m not sure I understand different, but you can change the theme of windows to use native system elements (X11, Windows, etc.) with the command from ttk import *:

Example:

Without the ttk:

Janela padrão

With the ttk:

Janela nativa

Example generated with:

from Tkinter import *
from ttk import *  # basta acrescentar ou retirar esta linha
root = Tk()
Frame(root)
if (root is not None):
    root.title("Teste")
    theLabel = Label(root, text="This is too easy")
    theLabel.pack(fill='both')
    sair = Button(root, text="Sair", command=quit)
    sair["state"] = "normal"
    sair.pack(fill='both')
    root.mainloop()

Browser other questions tagged

You are not signed in. Login or sign up in order to post.