PyQt5 Tutorial - Images and QPixmap

  Рет қаралды 165,042

Tech With Tim

Tech With Tim

5 жыл бұрын

This tutorial will show you how to create an image viewer with pyqt5 and python. Specifically we will design an application that can change between which images are being shown. We will design the UI using qt-designer then link the buttons to show different images from our code.
Text-Based Tutorial: techwithtim.net/tutorials/pyq...
Playlist: • PyQt5 Tutorial - Setup...
Get %30 off a GitPod.io subscription with the code: techwithtim
www.gitpod.io/
◾◾◾◾◾
💻 Enroll in The Fundamentals of Programming w/ Python
tech-with-tim.teachable.com/p...
📸 Instagram: / tech_with_tim
🌎 Website techwithtim.net
📱 Twitter: / techwithtimm
⭐ Discord: / discord
📝 LinkedIn: / tim-rusci. .
📂 GitHub: github.com/techwithtim
🔊 Podcast: anchor.fm/tech-with-tim
💵 One-Time Donations: www.paypal.com/donate/?token=...
💰 Patreon: / techwithtim
◾◾◾◾◾◾
⚡ Please leave a LIKE and SUBSCRIBE for more content! ⚡
Tags:
- Tech With Tim
- Python Tutorials
- PyQt5 Tutorial
- PyQt5 Image Viewer
- View Image PyQt5
- Images with PyQt
- QPixmap pyqt5
#python #pyqt5 #qtdesigner

Пікірлер: 85
@xgriff91
@xgriff91 5 жыл бұрын
Great video I love this library! Thanks for making these useful videos
@ggscreation4033
@ggscreation4033 5 жыл бұрын
Your way of teaching is amazing
@niiashrifie
@niiashrifie 4 жыл бұрын
You teach great. Your tutorials are loving.
@suganthiganesh6101
@suganthiganesh6101 4 жыл бұрын
Hello Tim, Great Series and clear explanation. Thanks a lot.
@romariocarvalhoneto7831
@romariocarvalhoneto7831 5 жыл бұрын
Awesome! Right to the point!
@miguelreyesgarcia9975
@miguelreyesgarcia9975 4 жыл бұрын
This video is better than others, It was very useful for me. Thank you! "Tech With Tim"
@farzadrazmavar8012
@farzadrazmavar8012 4 жыл бұрын
Thanks, It was helpful.
@carlosalbertofernandespalm9243
@carlosalbertofernandespalm9243 5 жыл бұрын
Hi Tim..Great series, congrats for your work. can i ask you to make one about reading a json file and navigate the result like the photos? thank you in advance,
@chinaguy101
@chinaguy101 3 жыл бұрын
Great videos, very clear
@ki4nkw905
@ki4nkw905 3 жыл бұрын
you made me understand codes , thanks
@birdeye700
@birdeye700 3 жыл бұрын
excellent job !
@paulhearn8145
@paulhearn8145 3 жыл бұрын
most fantastic - thanks
@askpartha
@askpartha 3 жыл бұрын
Hi Tim. Thanks. Precise.
@romanthchowan1578
@romanthchowan1578 5 жыл бұрын
please continue you classes ,im most awaited for them.if possible upload videos faster can you tell us where did you learn this stuff from
@maedehshahabi4744
@maedehshahabi4744 4 жыл бұрын
great like always
@Sergey_Latyshev
@Sergey_Latyshev 5 жыл бұрын
For people who prefer tabs as indents instead of spaces: add '-i 0' option to pyuic5.
@deepalisardesai110
@deepalisardesai110 Жыл бұрын
Thx
@mattwest5695
@mattwest5695 4 жыл бұрын
For anyone who is curious, the way Tim was describing how to set a path to images not in the same folder as the class is correct. For example, if you images are in a folder called "images" your photo.setPixmap looks like this: self.photo.setPixmap(QtGui.QPixmap("images/my_photo.png"))
@coldblaze5698
@coldblaze5698 4 жыл бұрын
true I dont like pyQt tutorials where people just show QT designer rather than creating with pyQt 5 itself.. Its just like showing HTML tutorial with a WYSIWYG editor XD These videos are just like clickbait
@purduephotog
@purduephotog 4 жыл бұрын
Is there a way in QT Designer to define all of the actions (similar to NetBeans) where actions are linked? i.e. clicking a button and defining all the actions it performs (in the GUI itself) rather than editing the converted python code?
@ashish2099
@ashish2099 Жыл бұрын
Thank you brother
@phoenixhacker1291
@phoenixhacker1291 2 жыл бұрын
Cool love your teaching way I subscribed your channel
@sarveshkhandelwal6039
@sarveshkhandelwal6039 4 жыл бұрын
Can I add a GIF as the background for my window? BTW Great Content!
@user-bc2ec6dg4e
@user-bc2ec6dg4e 5 жыл бұрын
Hi Tim Thanks for tutorials can you make video later how to select image from directory and put that image in qlabel after that let it to be added to sqlite database and after that when we will call raw from database let image to be displayed in qlabel
@krishmaina
@krishmaina Жыл бұрын
very informative tutorials. For your code above, if the piture has to be toggled between dog and cat pictures every 30s , how will you do it. How to use Qtimer for it.
@markushyytinen9330
@markushyytinen9330 3 жыл бұрын
Great series! Only downside for me is that i cant use QtDesigner for my school project :p
@wenschannel7560
@wenschannel7560 5 жыл бұрын
Hi Tim Great Joooob!! Btw you from Uottawa?!
@user-sj2gf9yn8s
@user-sj2gf9yn8s 4 жыл бұрын
Are there any requirements for the format of the picture? What format is the picture of that cat? I can’t use .jpg
@theoneandonly2441
@theoneandonly2441 5 ай бұрын
Hey, thanks for the video! Just one question, is it possible to place the buttons over the images? I placed 5 radio buttons over a widget where a map png was placed, but when I ran it on VS code, the the buttons were there but the map wasn't. Any fix on this?
@sudheshhegde5090
@sudheshhegde5090 3 жыл бұрын
Sir, can We play gif files from labels as we opened pictures? I tried to open but it didnt work out...Any other ways?
@sainco3036
@sainco3036 5 жыл бұрын
thanks.
@piyushranjansahoo9830
@piyushranjansahoo9830 4 жыл бұрын
Hi Tim, I am only able to select .png image files in pixmap format, it is not allowing to select .jpeg files and any other image files,..can you please help me in this regard?
@nawalhamed6394
@nawalhamed6394 4 жыл бұрын
how to add video instead images? inside the label?
@sanasm3359
@sanasm3359 3 жыл бұрын
can use pyqt5 for developing games
@user-cj3yu9nv1u
@user-cj3yu9nv1u 4 жыл бұрын
If we change the ui file and overwrite the python file again, won't all of your changes and methods disappear? Edit: How do we fix this issue? Can we inherit the class Ui_MainWindow in another py file? That is what I used to do in PyQt4 Thanks in advance.
@petrockspiracy3120
@petrockspiracy3120 3 жыл бұрын
Compared to using Page and tkinter this is like so easy to use it's actually ridiculous
@BdyPhrk
@BdyPhrk 4 жыл бұрын
How can I rotate an image around give point ? Let's say like an arrow in a speedometer ?
@zx3215
@zx3215 3 жыл бұрын
Great question)) Then kind of overlay two PNGs and make a speedometer indeed. I'm looking into it right now. I want to try PyQt5.QtGui.QTransform. Want to see if I can apply it to the image drawn. If this works, then the tilt of the needle will be just the rotational transform applied to needle.png
@larcurie
@larcurie 4 ай бұрын
When I try to install pyqt5-tools using pip, it shows an error: metadata-generation-failed. I think it is because I am using Python 3.12, and pyqt5-tools hasn't been updated yet? So how do I get the Qt Designer?
@krishnapoddar76
@krishnapoddar76 4 жыл бұрын
pls make a video on how to add animation to the gui in the qt designer pls pls
@IQUBE
@IQUBE 4 жыл бұрын
As a beginner, do you recommend using the QtDesigner or just hard coding? Thanks in advance!
@codywanserski9585
@codywanserski9585 4 жыл бұрын
i suggest you at least watch a hard code tutorial, just to understand the basics so when you have to connect things and make changes, you will want to be able to read whats there
@IQUBE
@IQUBE 4 жыл бұрын
@@codywanserski9585 Thanks!
@theprasun
@theprasun 3 жыл бұрын
You saved my life. Subscribed.
@codequick5693
@codequick5693 4 жыл бұрын
The code didn't work for me. When I clicked on the paste, copy... The window just closed. In the console it showed process finished with exit code -1073740791 (0xC0000409)
@WalidHefny-qs8bw
@WalidHefny-qs8bw 4 жыл бұрын
For me, that was because I created a dialog in PyQt5 designer, not a main window.
@Mikosi
@Mikosi Жыл бұрын
Hi, thanks for guides. I've a question. For example I've made everything you shown, but I need to change my .py file which I've converted from .ui. I need to change it it Qt Designer. Is there any method to convert .py to .ui?
@ksenia115
@ksenia115 2 ай бұрын
Just change your .ui file (it should be saved) and then convert it to .py again
@ggscreation4033
@ggscreation4033 5 жыл бұрын
Can you plse give a flowchart of python programming
@alerproduction
@alerproduction 2 жыл бұрын
I've got an error for the Pixmap, no images are being shown... AttributeError: 'Ui_MainWindow' object has no attribute 'setPixmap'
@farsear3403
@farsear3403 3 жыл бұрын
hey ! how convert this to exe with pictures in --onefile
@MdMubin-bp7wp
@MdMubin-bp7wp 3 жыл бұрын
Is it possible to view a multipage pdf file using PyQt5?
@squeecy9965
@squeecy9965 4 жыл бұрын
Is there any way that I can go back to Qt Designer and add stuff to my project, then that gets added back into my .py code?
@sayochikun3288
@sayochikun3288 4 жыл бұрын
you can create a widget and add its code to your project.
@yandere_lover-tl9zs
@yandere_lover-tl9zs 4 жыл бұрын
Bro, how do i have the image in the background!?
@zx3215
@zx3215 3 жыл бұрын
You mean - an image on the main form? Well... perhaps you can inherit from QMainWindow and make your own main worm where you'd override Paint and draw the image you like. That's the first thought...
@yggyberry8133
@yggyberry8133 4 жыл бұрын
Perhaps a dumb question: is there a way to design interface, convert it to python, add methods and than later alter the design also in Qt designer? Same like in MS Visual Studio?
@zx3215
@zx3215 3 жыл бұрын
i'd say no... although you can save the original UI file and change it, then produce a new .py from it when you need it. Pity Qt Designer cannot convert UI->py on its own.
@zx3215
@zx3215 3 жыл бұрын
Oh, and, by the way - you know there's a direct method of who you can use UI files in your py code? I mean: window = uic.loadUi("myWindowDesignedInDesigner.ui")
@marcoalban2105
@marcoalban2105 2 жыл бұрын
Hi! Nice video. Do you know how to save the full image of the PyQt window?
@gautamranka5220
@gautamranka5220 2 жыл бұрын
You could use Alt+prt sc(print screen) on windows and then paste it in paint or something like that
@erikb7758
@erikb7758 4 жыл бұрын
On MacOS, I could only get it work with the full absolute path, the relative path does not work for me. Just an FYI.
@shadoestorme
@shadoestorme 3 жыл бұрын
same
@user-sj2gf9yn8s
@user-sj2gf9yn8s 4 жыл бұрын
I can only use the png file, jpeg file is not allowed, why?
@bediosoro7786
@bediosoro7786 4 жыл бұрын
how to zoom in
@SPQRxUSAxNUSA
@SPQRxUSAxNUSA 3 жыл бұрын
I love your videos but I am a designer not a coder and I don't know what I will do - I need to be able to do everything in one app, visually rather than 2. :(
@shadoestorme
@shadoestorme 3 жыл бұрын
MacOS automatically converts the relative path into the full absolute path ex: ../../Downloads/IMG_20200110_192632.jpg Otherwise, the path starts from the test.ui file
@bijogxazindagi7545
@bijogxazindagi7545 3 жыл бұрын
its same in windows
@pythonocean7879
@pythonocean7879 5 жыл бұрын
play with css in PyQt5
@pythonocean7879
@pythonocean7879 5 жыл бұрын
bro do some projects on deep learning covolutional neural networks with PyQt5 like face based attendence system,face morphology etc.and tutorial is great as usual 😘😘
@dhruvenkalpeshkumarparvati4874
@dhruvenkalpeshkumarparvati4874 3 жыл бұрын
My image is not showing after compiling.......please help!!!!!!!!!!!!! @TechWithTim
@alerproduction
@alerproduction 2 жыл бұрын
It opens in pycharm but not in VSC
@mehi99
@mehi99 3 жыл бұрын
i followed this tutorial step by step but not sure why the image is not showing at all. Im using pthon3 on VSC
@ahnaftanjid5531
@ahnaftanjid5531 3 жыл бұрын
using python 3.9 and same issue. also using in vscode :/
@ahnaftanjid5531
@ahnaftanjid5531 3 жыл бұрын
guess what, run this with sublime text, the image appears perfectly : may be vs code has something to do with it. cost me 1hr :3
@clarkngpampanga7492
@clarkngpampanga7492 3 жыл бұрын
Same Issue, VS Code doesn't load the images. You can instead run your app using your terminal. It will work perfectly ^_^
@alerproduction
@alerproduction 2 жыл бұрын
It opens in pycharm but not in VSC
@unknownman5296
@unknownman5296 3 жыл бұрын
if you think Tim's video is not enough try reading the documentation, it have a lot more fun stuffs in it. www.riverbankcomputing.com/static/Docs/PyQt5/index.html
@christiandeinla8101
@christiandeinla8101 4 жыл бұрын
How to do it with multiple images?
@hairypaulsack
@hairypaulsack 4 жыл бұрын
with code, multiple images, image viewer etc www.learnpyqt.com/blog/adding-images-to-pyqt5-applications/ import sys from PyQt5.QtGui import QPixmap from PyQt5.QtWidgets import QMainWindow, QApplication, QLabel class MainWindow(QMainWindow): def __init__(self): super(MainWindow, self).__init__() self.title = "Image Viewer" self.setWindowTitle(self.title) label = QLabel(self) pixmap = QPixmap('cat.jpg') label.setPixmap(pixmap) self.setCentralWidget(label) self.resize(pixmap.width(), pixmap.height()) app = QApplication(sys.argv) w = MainWindow() w.show() sys.exit(app.exec_())
@codewithwasif3517
@codewithwasif3517 5 жыл бұрын
Legends says if you comment within 24 hours. Your comment will get pinned by Tim.
PyQt5 Tutorial - QMessageBox and Popup Windows
9:13
Tech With Tim
Рет қаралды 151 М.
How to use Qt Layouts
19:18
Velcode
Рет қаралды 91 М.
EVOLUTION OF ICE CREAM 😱 #shorts
00:11
Savage Vlogs
Рет қаралды 12 МЛН
Double Stacked Pizza @Lionfield @ChefRush
00:33
albert_cancook
Рет қаралды 121 МЛН
Spot The Fake Animal For $10,000
00:40
MrBeast
Рет қаралды 196 МЛН
Smart Sigma Kid #funny #sigma #memes
00:26
CRAZY GREAPA
Рет қаралды 8 МЛН
PyQt5 Tutorial - Buttons and Events (Signals)
9:58
Tech With Tim
Рет қаралды 377 М.
Creating Your Own Qt Applications...It's Easy!
15:27
DistroTube
Рет қаралды 36 М.
Python GUI Development Using PyQt5
22:08
NeuralNine
Рет қаралды 191 М.
How to make advanced image recognition bots using python
15:01
Kian Brose
Рет қаралды 1,3 МЛН
Working With Qt Designer's UI Files And PyQt
19:17
DistroTube
Рет қаралды 16 М.
Create Stunning Python GUIs in 10 Minutes With Drag & Drop
11:38
Coding Is Fun
Рет қаралды 42 М.
EVOLUTION OF ICE CREAM 😱 #shorts
00:11
Savage Vlogs
Рет қаралды 12 МЛН