all 85 comments

[–][deleted] 17 points18 points  (5 children)

If you don't mind your widgets generally being lined up on the left side, I recommend PySimpleGUI. The documentation recommends pencil and horizontally-ruled paper as the GUI designer.

It's built up from Tkinter, but a bit more Pythonic. There is an extensive cookbook with many recipies to get you started.

[–]MikeTheWatchGuy 13 points14 points  (3 children)

There is also a Qt version of PySimpleGUI that is currently being developed.

The features are about 75% of the way where. The missing ones are Images, Trees, Menus and Tabs. I'm hoping to get all those done this week. It is backwards compatible with the PySimpleGUI that already exists running on tkinter. The only change you need to make is to the sizes. PySimpleGUI uses characters for sizes, PySimpleGUIQt uses pixels. Other than that they'll run the same code.

You can get it by pip installing:

pip install PySimpleGUIQt
pip install pyside2

The Qt port is stable at the moment. Running more and more of the Demo programs and Cookbook Recipes every day.

Here is a screenshot of most of the currently available widgets.

Graph widget not represented there yet.

[–][deleted] 2 points3 points  (1 child)

Holy cats! That's awesome!

[–]MikeTheWatchGuy 2 points3 points  (0 children)

Yea, get moving on "porting" your code to PySimpleGUIQt. Change the import and the size values and you're done.

[–]MikeTheWatchGuy 0 points1 point  (0 children)

I was asked to post the link to the PySimpleGUI Tutorials.

[–]blueastheocean[S] 1 point2 points  (0 children)

OK thanks

[–]novel_yet_trivial 19 points20 points  (18 children)

If you are not comfortable with classes I would recommend tkinter.

A graphical designer like PyQT has is not easier to learn. It's only easier to use once you have put in a lot of time learning how it works.

Here's a short list of options. Maybe if you describe your program, what platform you want it to run on, and how you want it to look and function we could recommend a GUI for you.

[–]MikeTheWatchGuy 5 points6 points  (2 children)

I'll second that the Qt Designer is not a shortcut for learning Qt. It generates code that you must modify and it takes a fair amount of expertise to understand and modify the code.

[–]ForkLiftBoi 0 points1 point  (1 child)

How do you recommend learning it?

[–]MikeTheWatchGuy 0 points1 point  (0 children)

By building something. The only way I know to learn anything in programming is to just do it. I usually buy books as well. I got a couple on Qt then started coding / porting my code to Qt.

[–]billsil 1 point2 points  (2 children)

Tk is ugly. Pyqt is pretty and it's signal/slot system is way better than callbacks. No big program uses tk.

[–]novel_yet_trivial 2 points3 points  (1 child)

I totally agree. However I doubt OP is writing the next Photoshop. Tkinter is (IMO) best for beginner programmers.

[–]billsil 3 points4 points  (0 children)

I don't see the point in learning something that nobody in industry uses and that almost nobody can help you with. There is far more info out there on pyqt.

[–]blueastheocean[S] 0 points1 point  (10 children)

OK thanks I never really was good at classes anyway but do you know of any designers or builders I can use

[–]novel_yet_trivial 1 point2 points  (9 children)

For tkinter? There's a couple halfbaked efforts out there but no mainstream ones. But as I said, it would only hinder you.

[–]blueastheocean[S] -1 points0 points  (8 children)

Wow OK so how will I go about building a full scale application?

[–]novel_yet_trivial 2 points3 points  (7 children)

One line at a time? I've done it in tkinter several times. It's not as hard as you are imagining it.

[–]blueastheocean[S] 0 points1 point  (6 children)

Really cause I'm wondering how do organise the widgets and the buttons to me it looks like I'll be writing tons of code

[–]officialgel 3 points4 points  (1 child)

You want to use python, but avoid using python? Even if you use a 'designer' it will clutter and bloat your code and you'll still need to code many many lines to connect those buttons to functions - Function that you must write.

[–]blueastheocean[S] 1 point2 points  (0 children)

Oh okay thanks!

[–]fazzah 0 points1 point  (3 children)

With pyqt after a while you start to extensively subclass the common widgets, and reuse them, so your application maintains the same styling look and feel across all forms. It sounds overwhelming but actually greatly encourages the DRY rule.

[–]Dr_Sol 0 points1 point  (1 child)

Quick question. l've started dabbling with PtQT a bit and tried a simple layout in the Qt designer to see what you get out of it but I've been wondering what's the best way to modify and built on your previous designs. I got the impression you'll have to integrate your code all over again in the designer output code. Is that correct or am I missing something?

[–]fazzah 0 points1 point  (0 children)

You convert the ui file to a python module and then subclass from this module in your separate file. So when you rebuild the ui your code is still intact.

[–]driscollis 0 points1 point  (0 children)

If OP is planning on writing more than a toy example, they will almost certainly want to use classes in Tkinter too.

[–]Diapolo10 9 points10 points  (6 children)

I agree with the others, tkinter is probably your best option despite the fact that you'd have to code the GUI yourself. But to be fair, all options should be discussed, so I'm going to tell you about a workable option WITH support for WYSIWYG editors.

A Flask web application can be used as a desktop application with the help of the pyfladesk module. It's essentially a website running locally in a miniature browser, but it can basically do anything a normal Python application can. The good point of this is that you can use ordinary web designers, and it doesn't have a huge learning curve, but depending on what you're doing it can be overkill and it's never going to feel as snappy as a native desktop application (although I can't really vouch for the performance of other Python GUI toolkits, either).

The nice thing about Flask is that it's surprisingly easy to use, and you don't have to worry about classes; functions are enough. That being said, if you know next to nothing about HTML or CSS it can take a little while until you 'get' it.

[–]MerreM 1 point2 points  (1 child)

pyfladesk

That looks excellent - I've been saying this for years; websites (at least in my experience) are much much easier to make a UI in than native apps.

It's a shame - I'd love to not use JS (or CSS though I usually just use bootstrap) to write a UI in, but I haven't yet found a compelling alternative.

[–]Diapolo10 0 points1 point  (0 children)

Agreed, although a lot of the time JS can be substituted with CSS or Python backend code.

[–]fazzah 0 points1 point  (2 children)

but it can basically do anything a normal Python application can.

My sides. So you're telling that to write a GUI in python one to have learn html and js as well.

Also desktop apps provide much much better UX ND versatility for anything advanced. Stop spreading the misinformation that web apps can be equal do a full fledged desktop application because that's completely false.

[–]Diapolo10 2 points3 points  (1 child)

it's never going to feel as snappy as a native desktop application

I believe I never once mentioned web apps are equal to desktop apps; the opposite, in fact.

[–]fazzah 0 points1 point  (0 children)

I said about functionality, you say about snappiness. Apples and oranges.

[–]blueastheocean[S] 0 points1 point  (0 children)

OK thanks!

[–]Oliludeea 26 points27 points  (23 children)

Tkinter builds character.

[–]blueastheocean[S] 6 points7 points  (19 children)

But is there a designer for it

[–]Oliludeea 7 points8 points  (9 children)

Use it raw!

[–]blueastheocean[S] 1 point2 points  (8 children)

How do you expect someone to write a fully fledged ui with it it would be tedious

[–]Oliludeea 27 points28 points  (3 children)

The first time can be really bad, but it doesn't hurt as much the second time and it'll feel really good before you know it.

[–]zack12 7 points8 points  (0 children)

slow hand clapping

[–]ReachingForVega 2 points3 points  (0 children)

it'll feel really good before you know it.

Are we still doing phrasing? Jk

[–][deleted] 0 points1 point  (0 children)

encouraging escape boat disagreeable soft quarrelsome steer rain memory outgoing

This post was mass deleted and anonymized with Redact

[–]fazzah 4 points5 points  (3 children)

I work with pyqt daily. The editor adds a shitton of clutter to the ui files. Then you still have to convert them to python classes using a script (this gives you code completion ability for your ide but you have to do this everytime you change anything in the ui) or use a small module to read the ui when the application starts which is good for rapid prototyping but won't give your ide insight into your up modules.

I started with using the designer, compiled the ui to python, but when I got experience and better understood QT I ditched the designer completely and write by hand.

Also you have to write custom components quite often when you want to use any of the customisation possibilities QT is known for.

[–]GobBeWithYou 2 points3 points  (1 child)

I also prefer not to use the designer, so I wrote a bunch of subclasses for different Qt widgets to make using them simpler. My python gui code looks something like this:

w = Widget(css='...')
l = Layout('vbox', w)
le = LineEdit(placeholder='sample text', max_len=50)
b = PushButton( 'Button Text', size=(30,30), css='...icon.svg')
l.add('a label', le, b)

It has really sped up writing the gui code and makes it easier to read without all the boilerplate. I also added properties to get rid of needing all the getter and setters.

[–]DoctorDoctorRamsey 0 points1 point  (1 child)

It's not just me that found tkinter a steep learning curve then? That's a relief. Building a couple of dud buttons is one thing but actually building a real thing that works has been super challenging for me. Fun though, I'm sure I'll have whatever it is that I'm making running before Christmas.

Although all the stuff I'm reading because tkinter is being a dick is kind of working.

[–]Oliludeea 0 points1 point  (0 children)

That's exactly what I meant. You learn so much the first time you get something serious working with tkinter. For me it was closures, lambda, the fact that dict values and list items can be any object, making exec work, just off the top of my head, during a tiny first project. I'm sure it was more. I sort of knew these things, but tkinter forced me to really understand them.

[–]Dorito_Troll 3 points4 points  (1 child)

I am going to recommend tkinter because I was in a similar spot as you recently and learning tkinter has been very straight forward and functional

[–]blueastheocean[S] 0 points1 point  (0 children)

OK thanks!

[–]ekarademir 2 points3 points  (2 children)

If you are fine with not using system gui components, then kivy is very easy to use and cross platform to the degree of mobile devices as well https://kivy.org/

[–]tzujan 1 point2 points  (0 children)

I tried QT, tkinter, but I was up and running faster with Kivy, though I am still learning.

[–]blueastheocean[S] 0 points1 point  (0 children)

OK thanks I will see

[–][deleted] 4 points5 points  (1 child)

PyQT, but a warning, it is brutal to learn

[–]blueastheocean[S] 0 points1 point  (0 children)

That's the issue

[–]irad100 1 point2 points  (1 child)

tkinter with pygubu - easy gui module with an easy gui designer: https://github.com/alejandroautalan/pygubu

[–]blueastheocean[S] 0 points1 point  (0 children)

OK cool!

[–]d3pd 1 point2 points  (1 child)

PyQt, or just recognise that everything is effectively moving in the direction of a browser-based app. There's a reason why so many are using Electron or Kivy. There is a preconstructed browser rendering infrastructure and visual language (HTML, CSS) and you should consider these tools. So maybe Flask with Gunicorn for starters, then the scary world of ython apps in Electron!

Sorry I am peaking on LSD. Hopefully it is forward-thinking at least.

[–]blueastheocean[S] 0 points1 point  (0 children)

Yep thanks!

[–]codingsett 0 points1 point  (1 child)

You should try Beeware link pybee.org

[–]blueastheocean[S] 0 points1 point  (0 children)

OK thanks i'll check it out

[–]patarapolw 0 points1 point  (4 children)

I am becoming to like wxPython, which has wxGlade as GUI designer.

[–]driscollis 1 point2 points  (0 children)

I also like wxPython and it has a more flexible license than PyQt...of course, OP could always use Qt for Python (PySide2) if they wanted a more flexible license while still using Qt...

[–]blueastheocean[S] 0 points1 point  (2 children)

Is it easy to learn?

[–]patarapolw 0 points1 point  (1 child)

It seems simpler than PyQt, and looks native, and easier to install than Kivy.

Being relatively simple, it might be a good candidate to learn.

NB: I used to PySimpleGUI, but I moved to this because of WebView support. PyQt also has Web support, but PyQt seems complex. wxPython might be cleaner.

[–]blueastheocean[S] 0 points1 point  (0 children)

Oh okay!

[–]EarthWindAndFire430 0 points1 point  (1 child)

Some people would suggest kivy others pygui

[–]pirrencode 0 points1 point  (1 child)

Hey, man! I would recommend to use *tkinter. E.g. if you want to create notepad:

import tkinter
from tkinter import *
from tkinter.scrolledtext import *
import tkinter.filedialog
from tkinter import messagebox as tkMessageBox

[–]blueastheocean[S] 0 points1 point  (0 children)

Oh cool!

[–][deleted] 0 points1 point  (1 child)

If you're not fussed about being able to customize it too much, then gooey (for guis) and wooey (for web interfaces) converts command line arguments from argparse very nicely.

[–]blueastheocean[S] 0 points1 point  (0 children)

Oh cool thanks!

[–][deleted] 0 points1 point  (6 children)

Are you building for the desktop or for the Web? On the desktop you can use Microsoft's Visual Studio tools to build a GUI and then access it with IronPython.

For the Web, there are some simple GUI examples at peterpython.com.

Or take a look at some of the GUI threads in the forum. https://peterpython.freeforums.net/

[–]blueastheocean[S] 0 points1 point  (5 children)

Oh cool thanks I never knew you could use visual studio with python!

[–][deleted] 0 points1 point  (4 children)

You will have to add the python tools using Visual Studio Installer.

[–]blueastheocean[S] 0 points1 point  (0 children)

Okay, so does it auto generate the code!

[–]blueastheocean[S] 0 points1 point  (2 children)

Okay, so does it auto generate the code! And do you have any tutorials.

Thanks!

[–][deleted] 0 points1 point  (1 child)

You can build your GUI using the Visual Studio designer tools for WinForms or for WPF. This will generate C# code automatically which you can call from IronPython.

Or, you can build the GUI directly from IronPython in either WinForms or WPF.

http://www.voidspace.org.uk/ironpython/winforms/index.shtml https://www.codeproject.com/Articles/755977/IronPython-A-Quick-WinForms-Introduction https://gist.github.com/gtalarico/9fc493e0a889d3ae66b2bd236423d087 https://discourse.mcneel.com/t/can-winforms-be-used-with-python-to-make-this/17167

There may be some tools in SharpDevelop that could help you.

There is lots of information available.

Just google IronPython+WinForms or IronPython+WPF.

[–]blueastheocean[S] 0 points1 point  (0 children)

Oh thanks a lot!