Reputation: 10567
I'm making an app using python. I want a very simple user interface just to read a query. It should contain a text box where to type the query and a submit button. Can I make such an interface without using any drag and drop softwares, i.e just by using the code?
Upvotes: 2
Views: 21242
Reputation:
Well, there isn't really anything to say other than: no, you can't.
Unlike some other languages, Python cannot do too much without importing modules/libraries.
Meaning, to make a user-interface of any kind, you must first import a GUI development library such as Tkinter, wxPython, etc.
Upvotes: 0
Reputation: 13693
Well simply you can't do that with pure python
BTW start with Tkinter
as its more easy to learn than any other gui framework
Your expected code would look like in Tkinter:
import Tkinter as Tk
root = Tk.Tk()
def submit():
print "entered text were " + entry.get()
entry = Tk.Entry(root)
entry.pack()
button = Tk.Button(root,text='submit',command=submit)
button.pack()
root.mainloop()
By the way Tkinter is open source so feel free to look how the module is made
Upvotes: 5