Hi - Exploring Python

Hi Everyone,

I am learning Python and started using QT designer for my application.

I was able to design UI successfully with QT designer and was able to convert UI file to PY file as well.

I am struck at capturing the inputs from the screen to an output file. Would love any help on this

Thanks and Regards

By Madhav Kunapareddy via Discussions on Python.org at 09Apr2022 16:36:

I am learning Python and started using QT designer for my application.
I was able to design UI successfully with QT designer and was able to
convert UI file to PY file as well.

I am struck at capturing the inputs from the screen to an output file.
Would love any help on this

Can you post some of your code (I imagine the stuff coming out of the
designer is very verbose - we do not want all of it). Post code like

your code here

Note that those are ASCII backticks, often under the tidle (~)
character on a keyboard.

Saving data to a file generally involves having access to the data (via
GUI widget methods?) and opening a file and writing the data to it in
some fashion. It is hard to be more specific with information about what
you need to save and how your programme stores it.

And I am not a Qt expert, though I have used it a little via the PySide2

Cameron Simpson cs@cskk.id.au

Hi Cameron Simpson,

Greetings. Thanks a ton for the response. I will give you more information about the problem where I got struck…

The design is done in QT Designer and the .ui is converted into regular Python code.

We have used many input boxes for capturing various attributes required. The design works fine and the code also works fine for the design. It executes perfectly fine with Python as well.

However, I wanted to understand if there is a technique to capture data from various inputs with a click of a button or we need to write piece of code for each and every input widget ?

Would be happy to share the code as well, if you want to give it a try.

Thanks and Regards

Howdy Madhav,

have a look at this:


Cheers, Dominik

Hi Dominik,

Greetings. Thank you so much for sharing the link. I have gone through this as well.

However as the GUI that I am working is quite big and am little bit confused on the whole thing. I am attaching the snip of the GUI that I developed.

Thanks and Regards


This topic is very much of interest to me as I’m looking to develop a GUI front-end of a project on which I’m working.

I’ve been studying Tkinter, but would I a better off with Qt?

Your thoughts please.

With thanks.

Hi Rob,

QT designer is very much useful to design GUI. From my experience Tkinter is easy to develop code but at GUI level, placement of widgets is very tough.

I can share a sample GUI that I have created using QT for your reference. Kindly share your email

Thanks and Regards

@Madhav Thank you for that kind offer, which I may very well take you up on, but for now I simply want to get some perspective, as Qt could very well be overkill for my humble needs. At the same time I don’t want to get deep into the weeds of Tkinter, just to discover that my time would have been better invested with Qt.

My main gripe with Tkinter, is that the GUI looks a little dated (although I am very grateful that it even exists) but at the same time, as with anything that’s custom built, I believe that I can side-step things such as the Tk Menu Bar system and create my own custom Menu system using the much nicer Ttk Themed Widgets.

From your screen shot (looks very interesting, btw), I can see that you’ve a way more involved GUI than the one that I need and as such Qt is a better use case for you.

With thanks.

Hi Rob,

Greetings. I am trying hard to get this design to work with both Tkinter and QT… However, the GUI in Tk is not very attractive. Other than that Tk is very easy to code and playaround.

Wish you good luck and do let me know if you would need any tips with QT (Only for GUI design though)

Thanks and Regards

Hey Madhav,

It’s just occurred to me that maybe you guys are talking about Qt, specifically, rather than PyQt – sorry if I’ve soiled your thread.

For PyQt as well as much more on Python, Dan Bader over at realpython.com has some good content, but some of it is behind a paywall (a guy’s go to have a revenue stream I guess).

For now I’m going to continue with Tkinter as I’ve found no compelling reason not to do so, but I’ll keep an eye on this thread just in case said reason comes up.

Again, sorry for the kind of ‘off topic’ posts, but thanks for taking the time to reply.

Best regards to all and have a good day.

Hi Rob,

Greetings. That’s absolutely fine. I hope this is the spirit of the forum. To discuss and assist each other. I am glad that we could e-meet and exchange some info.

Please keep in touch and stay safe.

Thanks and Regards

1 Like

Howdy Madhav,

there are mainly two methods how to design a GUI using Qt:

  1. you can program all the code belonging to the GUI yourself - for that, you do not need the Qt Designer at all

  2. you can design the (static) arrangement of widgets (edits, buttons, …) using the Qt Designer and let it create the belonging code automatically and then just add/program the(dynamic) behaviour of said widgets (means: what happens, when e.g. a button is pressed)

In any case, in the end, the widgets are Python object instances assigned to Python names (“variables”).

Have e.g. a look at the following example:


where a button object instance is created and named “button” by:

button = QPushButton("Click me") 

In a Python script, you can access the attributes/methods of such a button - to e.g. get the text of the button, you could use:

button.text()    # ==> gets you "Click me"

(e.g. also have a look at this example: PyQt5 | How to get the text of Push Button ? - GeeksforGeeks)

To summarize all that: after designing the arrangement, you can add functions to widgets alike buttons. - this typically is done by programming them (and not just by clicking in the Qt Designer…).

To get a deeper understanding, feel free to have a look at the source code of an example of a small Qt application which has been developed “completely manually” - I mean: without using a Designer:

How exactly you can get/see the source code etc. you’ll understand, if you watch the video from the start…

(it can be found inside this zip file here: blythooon · PyPI )

Hope that gets you started :smile:
Cheers, Dominik

Howdy Rob,

If you just need a VERY simple GUI, Tkinter might be the choice, as it is easier to learn/handle.

But Tkinter is very limited. If you want a modern, sophisticated GUI, Qt might indeed be the better choice.

Maybe said video / source code I pointed out to Madhav may also be a good starting point for you…

Have Fun,
Cheers, Dominik

  • in the end this all is quite the same… :slight_smile:

PyQt is just a wrapper resp. binding-to-Python of Qt

I personally prefer PySide as such a wrapper / binding; beyond the software development one also has to keep an eye on topics alike licenses and so on too…

Cheers, Dominik

Hey Dominik,

Thanks for that. I’m a noob to GUIs in Python and not over experienced in ‘pure Python’, having only been using it for around 3 years, with a gap of little to no use over the past 9 months or so.

From what I’ve read and seen, I think that Tkinter will serve just fine for now, thanks. When I’ve hit the limiting factors, I will explore the alternatives, but right now, I need to level up my skills and I don’t see that Tkinter has that steep of a learning curve and as such, I’ll not be spending more time reading, than coding.

Cheers and be safe.


edit to add: I’m helping @JaysMartinez with his project and I’m building a GUI front-end for that, just for my own learning.

1 Like

I’m guessing you might want to update your readme—it states that blythooon is for developing GUIs for Qt 4/PySide 1/Python 2.7, which are more than a decade old, EoL and rather obsolete, at least for everything but maintaining old legacy applications that haven’t been ported to something less ancient, much less as a rationale choice for developing a new one. This is especially so now that Qt6, PyQt6, PySide6 and QtPy 2.0 (which drops support for Qt/PyQt/PySide <=5.9, particularly notable as it is a compatibility shim after all) have been out for some time.

Shameless plug (I’m one of the maintainers), but you might want to look at QtPy if you want an abstraction layer (developed by the scientific Python community) that shims over and insulates you from the differences between the bindings, and the Qt versions (6, 5 and previously 4). This allows both your developers and your users to easily support and use both bindings in one codebase with little to no extra work, allowing you to support more users and platforms, avoid any licensing or maintenance concerns with a particular binding, and greatly eases upgrading to newer, more modern Qt versions while still supporting legacy frameworks.

You are guessing wrong :grinning:

Interesting, thanks for the hint.

Cheers, Dominik

Do you really mean to recommend the demo application, the code for which won’t even run under any supported version of Python, of a proprietary, closed-development-model toolkit for a language/runtime, framework and binding that have superseded over a decade ago and all EoL for at least several years? Speaking as one of the maintainers of one of the largest, most popular and longest-lived Qt-based Python scientific applicaiton (and contributor to several smaller ones), and of the most widely used Qt abstraction library for scientific programs, this seem like a pretty questionable example to give a beginning user interested in developing a new GUI application.

This is particularly so when much more modern, powerful, and widely used Qt-focused scientific distributions exist that are FOSS and easier to install, e.g. Anaconda, Miniconda, Miniforge, WinPython, etc., as well as the official PyPI packages for remotely recent versions of the various projects mentioned all using wheels that allow simple installation using convectional packaging tools as opposed to the highly non-standard approach used by the blythooon package that is not a valid sdist, nor is installable with any standard Python tooling.

yes, I do.

In that case, while most of the high-level advice seems generally reasonable, @rob42 and @Madhav if you are interested in using Qt, I’d suggest referring to an example, tutorial and environment that works properly with supported versions of Python, Qt and PySide/PyQt, follows good practices, and is easy to install and get started with using standard, widely used tools. In addition to the above examples, I can suggest other/more specific ones, if desired.