S
S
S0ulReaver2012-01-03 23:44:18
Python
S0ulReaver, 2012-01-03 23:44:18

PyQT and images

Sorry for the simple question, but please help.

After studying Python, in terms of syntax, the desire came to fasten the graphical interface. The choice fell on PyQT. As a training, I wrote a short script that reads the user's last Tweet and displays it on the form in the Label. Then there was a desire to fasten an avatar to the text next to it, and here it hung. Before that, I used Delphi as the main language, and in general I was surprised not to find any component of the Image type in the PyQT designer. Began to look for options. Only one idea came to mind - since you can use HTML / CSS in QT components, why not use it? I added another empty Label of the required size, and instructed the designer to use a picture with such and such a name in such and such a folder (which, in theory, will be loaded during the script). Well, when I run the script, I load the icon, put it in the right folder, and call Label.Udpate(), which, according to my expectations, should have led to results, but it seems that I do not understand something. After Update(), the picture in the Label really appears, but not completely, but only a small part of it in the middle (a strip from edge to edge). The brain suggests that this is happening because it was in the middle that there could be some text (if there was one), but how to get out of the situation - I have no idea.

In general, something tells me that there should be simpler and more universal options, otherwise what I do is some kind of crutches. Can you please tell me how to implement this correctly?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question