Python with Windows Form or graphical interface

Asked

Viewed 11,259 times

2

Hello, I’m a beginner in Python 2.7 and I’m wondering how to apply GUI in applications developed with Python, just like html does the interface for php and visual studio is used to make windows form in c#, but and python how it works?

  • I recommend working with the Glade Inteface Graphics Builder. It’s a great tool because you model your program through visual construction. Glade generates an xml that is easily communicable with Python. If you want to know a little more the site is the one of the download: <https://glade.gnome.org/>

  • Gtk is another graphical tool for python http://www.pygtk.org/

  • Pablo, if you work with Glade, then send examples. Because the documentation there is awful! Tutorial does not open and redirects to other links. The English is quite "easy", but in terms of documentation, it is bad. I would even really like to use Glade if it was really good (well documented) to learn how to do it well. Only, for those who want to start, in the use of the creation of Guis, does not serve. The spreading is beautiful, but in practice, does not work.

1 answer

8


Python works with various toolkits for graphical interfaces, such as Gtk, Qt and wx, but standard Toolkit is Tkinter.

A basic example you can try:

from Tkinter import *

def Cumprimente():
    hello.set("Olá, você!")

gui = Tk()

gui.title("Py5 - Python + Tkinter")
gui.geometry("400x300")

btn = Button(gui, text="Cumprimente", command=Cumprimente)
btn.pack()

hello = StringVar()
lbl = Label(gui, textvariable=hello)
lbl.pack()

gui.mainloop()

Can save this as any file from ". py" extension in Idle and run through it itself (F5).

  • showwww vlwwwwww

  • @Cachuera, I’m glad it was helpful. Welcome and please signal the answers that solve your problem as answered, ok? :)

  • how do I signal??

  • There is a gray mark below the arrow pointing down on the answer. It turns green when you click.

Browser other questions tagged

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