Python: Desktop UI for my python script - python

Im new to python and want to create a GUI front-end (desktop, rather than web) for my python script. The script essentially parses XML files and runs various searches over the contents (eg. accepts regex searches from the user, returns results etc).
It works well on the command line but I want to present a more user friendly interface.
There seems to be a lot of options out there - http://docs.python.org/faq/gui.html
Or should I look elsewhere?
Can someone recommend a GUI toolkit for Python?
Cheers.

I recommend using one of Tkinter, wxPython or PyQt. They are all equally suitable for a simple task. My personal favorite is Tkinter because I think it is the simplest way to get started. However, any of those would make a fine choice.

Here is a page on the Python wiki with some fifty options.

PyQt is great, although it's on GPL. There is also PySide alternative on LGPL.
You can also try wxPython or PyGTK if you don't like Qt for some reason. There is also gui library in python standard library called Tkinter, but I haven't used it and don't have any experience with it.

Related

Is it impossible to create GUI in python without tkinter?

I wanna know, Is it possible to create GUI in python without using tkinter?
Tk isn't technically making the GUI, it's delegating to a C library; and that's exactly what you can do too. For simplicity however, it's pretty much standard to use TkInter, or some other framework (i recommend PySimpleGUI) that takes care of the Tk interaction for you
easygui is the easiest GUI python that I have used. Designs are prebuilt for you already. Examples of easygui can. be found here https://pypi.org/project/easygui/
You can also use Flask where the frontend will be the web browser.
Tcl/Tk is an external library although it comes as part of the standard python install and it is an external library. you can use other framework to do that .
Fundamentally, Python can’t talk to any GUI system without an external module. Since the most fundamental GUI libraries on any platform are usually C-based, that requires, at minimum, importing a library like ctypes which itself is minimal and allows you to load system GUI libraries (in dlls or delis, depending on your platform).It is possible, in theory at least, to drive a GUI solely from ctypes, but it’s not very practical .

Python 2.7 accessibility for blind

Hello I am planning on creating a program in Python 2.7 using a tkinter GUI. I am looking for some guidance on the best method to play text as audio in order to aid people with visual difficulties.
The text that will need to be played would be text on buttons and text within textboxes. are there any libraries I can import that can help me achieve this?
Thanks.
The answer appears to be 'no'. According to tcl/tk developer Kevin Walzer "Tk doesn't support [screen readers]. I've looked into it a bit and it seems like a huge project to implement on a cross-platform basis." See link for a bit more.
If you really want to develop an accessible GUI application in Python, you shouldn't use Tkinter since it is not accessible at all.
Consider using some framework that has bindings to native APIs/controls, for example, WxPython which is a Python port of WxWidgets.

Need Windows GUI for Python .exe script

I wrote a py .exe script and need to create a GUI for it with a file path input field, a 'cancel' and 'ok' buttons. How can I accomplish it best? Do I need to bind it with any C libraries? I know I could easily create a web based interface but I do not want a web app, I need a .exe app.
Please, help!
For such a simple GUI, Python comes with a built in library: TkInter. It's somewhat ugly, but it might be fine for your purposes - requires nothing 3rd party, so no additional installations. If you want something more full featured, I'd suggest PyQt
wxPython is the best thing I can think of.
Have a look at easydialogs for window http://www.averdevelopment.com/python/EasyDialogs.html

Python custom GUI

I googled and search stackoverflow before asking this question
Answers that I don't expect:
wxWidgets is the best Python GUIUse TkInter (BIM) for GUI development.
Q. How to make a GUI without using any module/library? i.e make a GUI from scratch. Modules like tkinter not allowed.
I've made several GUIs from scratch using SDL which is a low level drawing library. The advantage of doing that is that it will look exactly the same on any platform down to the pixel and you can get it to work on embedded systems. Full screen GUIs are really easy too. Disadvantages are that it is a lot of work.
In python the pygame library wraps SDL so you would use that, and in fact that is how I made the GUI for a lab instrument which had a large colour LCD screen. The controller ran linux, but not X-windows.
pygame is an extra library, yes, but I can't think of a way of making a GUI with only what python provides.
The easiest GUI to make without "module/library" is a web-based one. I.e. generate HTML with Javascript from your Python code, and let the Javascript interact via AJAX with your Python app. This can be implemented without too much effort with just the standard Python library (and some JS code, of course), or with modules that don't require "heavy" installation of platform-specific extensions.

Python GUI(tkinter; pygtk+glade), py2exe

I'm new with python programming and GUI. I search on internet about GUI programming and see that there are a lot of ways to do this. I see that easiest way for GUI in python might be tkinter(which is included in Python, and it's just GUI library not GUI builder)? I also read a lot about GLADE+PyGTK(and XML format), what is there so special(glade is GUI builder)?
Can anyone make some "personal opinion" about this choices?
I have python code, I need to make simple GUI(2 button's-open-close-read-write,and some "print" work) and then make some .exe file (is there best choice py2exe=?). Is there a lot of changes in code to make GUI?
Many thanks
If your GUI is really that simple, you should go with the built-in tkinter.
There's a Hello, Tkinter tutorial that you can follow, it's pretty straightforward. Concerning the creation of executables, py2exe should work without problems in most cases (though I haven't tried with tkinter). Another way to create an executable is to add a special parameter to your "setup.py" file:
setup(...,
entry_points = {"gui_scripts" : ['name-of-executable = name_of_package.launcher:main']})
This would, for example, create an executable that can be run by typing "name-of-executable" into a terminal (even on Windows if Python's "scripts" path is in the PATH ^^). It runs the function "main" in the module called "name_of_package". That way, you don't have to use py2exe but can create a Windows installer, or a Debian package, for instance.
For more complex projects, I can absolutely recommend PyGTK with Glade as interface designer. It requires several Python packages to be installed, plus a GTK+ installation (which is not always that easy on Windows). The API is awesome, well-documented and Glade is very easy to use, once you get used to the layouting concepts of GTK. But my opinion is kind of biased because I've done multiple projects in PyGTK. wxWidgets or PyQT are good alternatives. For example, bazaar explorer is written using QT.
I really like PyQt bindings for Qt library.
What is PyQt?
Qt itself is a very nice framework - rich, powerfull, elegant (for my taste, at least). And PyQt does a very nice job of exposing that functionality to a scripting environment.
Plus, there is a very nice book about PyQt development - Rapid GUI Programming with Python and Qt - working through it helped me a lot.

Categories