2014/08/06
How to make a Python GUI (Graphics User Interface)
Bit off topic from the usual astronomy. But recently I needed a way to make a GUI, and as I use Python a lot, it seemed the logical option to make a nice simple easy to use GUI. The module Tkinter seems to be one of the best options to use and a basic tutorial can be found here: http://sebsauvage.net/python/gui/. If you are using Anaconda for running python (see earlier post) this module comes installed and ready to use with some other really nice modules.
Tkinter: Run the GUI, add buttons, input fields, text, menu bars etc...
tkFileDialog: To add filebrowers for saving and opening files
tkMessageBox: For all those really annoying pop up boxes
Basic structure seems to be using a "Application Class" with methods for initializing the "widgets" (i.e. the buttons, input fields and text etc) and then I have found storing all the input data to a dictionary seems to be the easiest way of doing it.
Also had to use an image module to import some pictures and for that a module called PIL seems fairly useful (Also installed by default on Anaconda)!
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment