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 .
Related
So, I have been wanting to make my own GUI library for Python 3. And I couldn't find anything anywhere on where to start. So I decided to ask the question here.
Goal:
Be able to make Python Libraries without using other libraries.
Edit:
So, If I was to make a Library in C for Python. How would I go about doing that.
Tkinter is a python wrapper around tcl/tk's GUI toolkit , similar to how PySide/PyQt and wxPython are wrappers around the Qt and Wx C++ GUI toolkits.
If you wanted to build your own from scratch you would have to make use of existing operating system APIs and/or use something cross platform like OpenGL. For a good example of the latter you can look into Kivy, which is built on OpenGL
Different operating systems have different API's for doing GUI's. So how you have to do it very much depends on the operating system. I think one of the reasons that Python uses Tkinter is because it was already ported to different operating systems.
GUI API's are typically provided as shared libraries, often written in or compatible with C.
If you want to use those from Python, you will have to write a Python wrapper for them. For example using ctypes. Doing that requires a significant understanding of (1) Python, (2) ctypes and (3) the GUI API in question. If more than one of these technologies is new to you, I would not recommend taking on such a project.
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.
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.
Features needed:
A framework, allowing me to build tab-based application with custom design (like in Hotot twitter client), keeping the native os window frame.
Compatible with Python.
My application will be running under Win/OsX/Linux/.
No Flash/Flex/AIR.
I also would like to ask if PySide does meet my requirements and is it worse or better than wxPython and Tkinter mentioned already?
Use Tkinter. It works on every platform that Python supports, is relatively easy to program in, looks pretty good on most platforms, and has the features you want. It's also built-in for most versions of Python, so your users (in many cases) will not have to install any external dependencies.
I find that Tkinter looks best on Mac OSX and Windows, and slightly outdated on some Gnome desktops. The most important feature, however, is that the API is extremely clean and easy to use and it is very lightweight. PyQt has a similar feature set, but, in my experience, its performance is significantly degraded when compared to Tkinter.
PySide is Nokia's Qt binding for Python. I'm not aware of what the differences are between it and PyQt. Ultimately, most GUI toolkits for Python are going to be cross platform and support the functionality you need. I suggest Tkinter because I feel it is the easiest and most pleasurable way to program GUI applications in Python.
I am the author of Hotot.
according to your requirements, the key for you to choose a framework is the UI framework should be able to access webview conveniently.
Hotot has several wrappers for different platforms. On Linux, we have both Qt and GTK version, on Windows, we provide a Qt version, on Mac, we have a Cocoa version, and of course we have a Chrome version. In a word, all they can easily access webkit.
PS: XULRunner is another good choice for native appearance.
Additionally to the advices given by other people, I suggest you to use PyQt which is a Python binding to Qt framework. It's widely used, cross-platform and feature-full.
Take a look at wxPython (based on wxWidgets). If you want to make it web-based, look into using Django.
Well, you mentioned PyHotOt, and it says (on its web site) that it uses pywebkitgtk, and PyGTK. PyGTK/PyWebKitGTK exists for windows. Did you check it out? I think OS X would be the weak link on GTK, but maybe it's pretty good too.
Now don't get me wrong, I'm not exactly a Python fan, but when you see a Tk directory inside of the python directory you kinda expect... Well Python. And yeah, I get that Tk came from TCL, but if I had to write a TCL to use Tk, I'd forget TK existed and use a completely different tool box. (The popularity of this combination completely eludes me.)
Expecting to see a relatively readable language like Python, and finding TCL is like walking in on your grandma naked. It's just visually painful.
I haven't drank the cool-aid when it comes to Python, but I use for simple task that I don't want to bother with C or C++ on and maybe if I want some for quick and dirty text processing. It just seems like a cruel joke to put TCL examples in the Python distribution.
Is there an equivalent package that includes those examples written in Python?
Edit:
I guess this also kinda begs the question is Tk the best option for GUI dev in Python?
There are no Tcl examples in Python's official distribution; whatever distro you're using must have bundled them on its own volition.
IMHO, Tk's only real advantage by now is the convenience that comes from having it bundled with Python. I was criticized for covering it in "Python in a Nutshell", but I stand by that decision because it is still "the" bundled toolkit, after all. But if you want something better and don't mind taking a tiny amount of inconvenience to procure it (and possibly to bundle it with apps you distribute), there are other excellent choices.
PyQt (if you can stand the GPL license or pay for the commercial one) and wxPython are IMHO currently superior offerings for cross-platform GUI apps (though you'll have to work to bundle them with py2exe or PyInstaller if you want to distribute a stand-alone app) and other packages are excellent if you don't care about cross-platform distribution or have specialized needs (e.g. pyui -- while now a general-purpose UI toolkit -- for simple UIs for games if you're using PyGame or PyOpenGL anyway).
Perhaps you should start by looking at the Python Tkinter documentation here and the Tkinter wiki here.
And where are you seeing Tcl examples? Are you looking at a Tcl library supplied with Python perhaps?
TCL / TK is a simple language to understand with which the applications are made very simple, very quickly occupying very few resources and hardware platform to be run on all platforms.
In TCL / TK exist there is also starkits or freewrap allowing wrap libraries, code and other files into a single package easier to carry around, to other platforms and run and install, without being necessary to bring all the libraries brings language.
While the evaluator of TCL / TK requires 3MB, the python requires much more, and uses many more that unused libraries.
When these applications grow, it is logical to migrate first to python and share the GUI using Tkinter, then they can move on to other GUI as QT or Wxwidgets, to work faster.
Who want to program with Tkinter, you must know how it works TCL and TK GUI with which are made tkinter.
Today is not here another library module GUI that there be a versatile as tkinter into a single file that allows cross-platform applications remain to be small and modular for all basic python project.
While tkinter is 2 MB, wxwidget are 80 MB and if you take a calculator, a notepad or a drawing application, you'll want a small GUI easy to incorporate into your projects.
Besides that today made Tkinter applications run faster and better in small devices with limited hardware, ARM or raspberry o smartphones but wxwidgets becomes slow.
If your application is basic and small and you platform is not robust chooses Tkinter, but if is big and heavy and platform of very much resources chooses wxwidget o QT.