Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I would like to try to write a GUI application in Python. I found out that there are a lot of ways to do it (different toolkits). And, in this context, I have several basic (and I think simple) question?
Is it, in general, a good idea to write a GUI application in Python?
What is the standard (easiest and most stable) way to create a GUI applications in Python?
Does anybody can give me a link to a simple Hello World GUI application written in Python?
Depends on what application you are writing. I would use Python for a simple GUI, yes.
Use a proper toolkit (such as PyQt - Python bindings for the popular Qt)
Sure
Hello world in PyQt:
import qt,sys
a = qt.QApplication(sys.argv)
w = qt.QPushButton("Hello World",None)
a.setMainWidget(w)
w.show()
a.exec_loop()
I am really fond of pygtk and glade. Pygtk is a python binding for gtk, the gui toolkit used in gnome. Glade is a user interface designer which stores a gui as xml, which can be loaded in pygtk.
http://www.gtk.org/
http://www.pygtk.org/
http://glade.gnome.org/
If you want to see some example code, you can take a look at my project https://launchpad.net/pumped. Just download the source.
If you're looking to make a fairly simple GUI, then PyGTK is extremely easy to use:
http://www.pygtk.org/
A tutorial (with downloadable sample code) can be found here, and another one on the Wiki.
As an answer for #1: Yes. It is quite good for this; scripting languages with GUI toolkits are often a good way to put a GUI on an application. They can also be used to wrap applications written in low level languages such as C or C++. Python offers good integration to quite a few toolkits. The posting linked above gives a pretty good cross section of the options with code samples.
For #2: TkInter comes with the standard distribution. It is easy to use but not as sophisticated as (say) QT or WxWidgets.
python is ok for gui better than perl and ruby heres some tk
from tkinter import *
from tkinter import ttk
root = Tk()
ttk.Button(root, text="Hello World").grid()
root.mainloop()
If you want to learn some GUI programming in Python using Tkinter, you can see a step-by-step process of building a simple MineSweep clone in twelve progressions here: MineSweep for Python 3.x
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 months ago.
Improve this question
I am relatively new to coding and I'm currently doing my a level computer science coursework. I'm doing a text based RPG game in python 3. The problem I've ran into is I've coded the entire game with the outputs into the console of VS code, but I need to create a gui for the game. Just a simple window with one textbox that outputs everything the console outputs currently and a textbox that allows for any user input via typing. And maybe a backdrop for the gui. I've scoured the internet for solutions but I cannot find one. The gui don't need to be very fancy. Does anyone have the knowledge of any modules of ways I can easily slap a gui ontop of my code? Thank you in advanced.
For a basic GUI you can use TKinter: Documentation
It's very easy to use and there are a lot example on the web that you can reference
I believe you can use the tkinter (“Tk interface”) package for this. It's a simple and straightforward standard interface in Python to the Tcl/Tk GUI toolkit, and the only GUI framework that comes built into Python itself. Considering your mentioned requirements for the project, you should easily be able to create what you want — an entry widget, for instance (example).
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I am new to Python and to train myself, I would like to use Python build a database that would store information about wine - bottle, date, rating etc. The idea is that:
I could use to database to add a new wine entries
I could use the database to browse wines I have previously entered
I could run some small analyses
The design of my Python I am thinking of is:
Design database with Python package sqlite3
Make a GUI built on top of the database with the package Tkinter, so that I can both enter new data and query the database if I want.
My question is: would your recommend this design and these packages? Is it possible to build a GUI on top of a database? I know StackOverflow is more for specific questions rather than "project design" questions so I would appreciate if anyone could point me to forums that discuss project design ideas.
Thanks.
For a beginner, these packages are well suited.
tkinter and sqlite3 are both builtin in the standard library, so you don't have to install complicated MySQL or GUI libraries. There are many tutorials outside for both libraries.
I think you can even search for something like tkinter with sqlite3 and you will find some examples.
Combining tkinter and sqlit3 is no problem. I did't read the full answer but I think this could be a useful resource: Python TKinter data entry window GUI for SQLITE3 table
If you have specific questions about how to achieve certain things you are welcome to ask them in the comments of this answer.
If it's just for you, sure there is no problem with that stack.
If I were doing it, I would skip Tkinter, and build something using Flask (or Django.) Doing a web page as a GUI yields faster results, is less fiddly, and more applicable to the job market.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I'm not exactly sure to describe it so here is a basic storyboard of what I would like to do using Python: http://i.stack.imgur.com/dciMH.jpg
I'm quite new to GUI programming so I'm unsure which Python module is best for this. I've had a little look at Tkinter. How I would get the screen to change to the second image after the next button is pressed without opening a new window in Tkinter?
Secondly, what are some other GUI Python modules that you would recommend for this sort of project I'm doing?
Tkinter is a perfectly fine toolkit to lean on, as are other toolkits. The advantage tkinter has is that you probably already have it installed. Plus, it is very simple to use, and very powerful.
To answer your question on how to get the screen to change: tkinter uses geometry managers named pack and grid (and to a much lesser extent, place) to layout your widgets in a window. These geometry managers have the feature that they can be asked to remove a window, making it invisible.
You can, for instance, create each "page" as a Frame with other widgets inside. To switch pages, call pack_ forget or grid_forget to hide the current page, then pack or grid to show the new page. This is a very common and useful technique. grid_remove has an added feature in that it remembers the options that were used to originally display the window, makinging it a little easier to toggle it between being visible and hidden.
http://www.wxpython.org/
I recommand wxpython.
if it's simple, do within wxpython.
I did that in pygtk by using a tabbed widget with hidden tabs.
You can design it in glade and later automate switching between tabs in your code.
Nowadays I would probably go with QT for a new project, though I haven't yet.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 2 years ago.
Improve this question
I want to create a 2D game on Python with heavy user interface: windows, buttons, text input, etc. So far I've been using PyGame for a few simple games.
The game is a 2D MUD, with the standard rendering loop to draw stuff on the screen. I need the user interface to interact with the game entities like sales, blacksmith, etc.
I am looking for something like a mix of Pygame and wxPython/pyQT/pyGTK.
Which libraries can I use?
I would take PyQT with QGraphicsView or QGraphicsScene.
Sadly there isn´t a Clanlib python binding like for perl and ruby. That would be, probably, the ideal choice.
You can use the popular Pyglet game library along with wxPython, the cross platform GUI library. An example of how to do this:
http://pyglet.googlecode.com/svn/trunk/experimental/wxtest.py
Additionally, if you want to use pure Pyglet, you can use Kytten, a pure Python GUI library built on the top of Pyglet.
Not sure if it fits your use, but PGU is fit for pygame because it lets you use your own render loop, and tie into it.
http://code.google.com/p/librpg/ maybe what you need
tkinter is one choice. It has a canvas widget that is very easy to use -- you can draw objects (lines, circles, etc) as well as embed images (for tiles, for example). And of course it comes with a standard collection of widgets (buttons, comboboxes, listboxes, menus, etc) that can either be embedded in a canvas or used in the more traditional sense.
Take a look at librocket. It supports python scripting as well..
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
I'm done with my class project which I coded using Python. I'm working on the extra credit part i.e. GUI development - Windows platform.
I need something simple, easy to use, possibly drag-and-drop GUI development tool for Python. GUI needs to look somewhat like google, since all my project does is:
input: Company name
output: Ethical or Unethical
So, all I need is:
An attractive image
Input textbox
Search button
Output box
Take your pick here.
Tkinter is in the Python stdlib.
Try with Kivy! kivy.org
It's quite easy, multi platform and a really good documentation
Tkinter is simple but is too ugly. PyQT can do everything you want but is too big. Perhaps IronPython will be good for you. Take a look at this: Python guis
Glade or wxGlade.
EasyGUI for very easy GUI Development
I prefer PyQT although it is pretty big. It has all the features that normal QT has, and that's why it's very usable. I think you can use QML with it too.
I would recommend wxpython.
It's very easy to use and the documentation is pretty good.