PyQt5 Tutorial - Images and QPixmap

Поділитися
Вставка
  • Опубліковано 11 гру 2024

КОМЕНТАРІ • 86

  • @Sergey_Latyshev
    @Sergey_Latyshev 5 років тому +13

    For people who prefer tabs as indents instead of spaces: add '-i 0' option to pyuic5.

  • @miguelreyesgarcia9975
    @miguelreyesgarcia9975 4 роки тому +2

    This video is better than others, It was very useful for me. Thank you! "Tech With Tim"

  • @mattwest5695
    @mattwest5695 4 роки тому +1

    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

  • @ggscreation4033
    @ggscreation4033 5 років тому +1

    Your way of teaching is amazing

  • @ki4nkw905
    @ki4nkw905 3 роки тому +1

    you made me understand codes , thanks

  • @phoenixhacker1291
    @phoenixhacker1291 2 роки тому

    Cool love your teaching way I subscribed your channel

  • @niiashrifie
    @niiashrifie 4 роки тому

    You teach great. Your tutorials are loving.

  • @theprasun
    @theprasun 3 роки тому +1

    You saved my life. Subscribed.

  • @xgriff91
    @xgriff91 5 років тому +1

    Great video I love this library! Thanks for making these useful videos

  • @askpartha
    @askpartha 3 роки тому

    Hi Tim. Thanks. Precise.

  • @ashish2099
    @ashish2099 2 роки тому

    Thank you brother

  • @romanthchowan1578
    @romanthchowan1578 5 років тому +1

    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

  • @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.

  • @suganthiganesh6101
    @suganthiganesh6101 4 роки тому

    Hello Tim, Great Series and clear explanation. Thanks a lot.

  • @carlosalbertofernandespalm9243
    @carlosalbertofernandespalm9243 5 років тому +7

    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

  • @paulhearn8145
    @paulhearn8145 3 роки тому

    most fantastic - thanks

  • @codequick5693
    @codequick5693 4 роки тому +2

    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 роки тому +1

      For me, that was because I created a dialog in PyQt5 designer, not a main window.

  • @birdeye700
    @birdeye700 3 роки тому

    excellent job !

  • @maedehshahabi4744
    @maedehshahabi4744 5 років тому

    great like always

  • @张燚-p2w
    @张燚-p2w Місяць тому

    many thanks

  • @farzadrazmavar8012
    @farzadrazmavar8012 4 роки тому

    Thanks, It was helpful.

  • @romariocarvalhoneto7831
    @romariocarvalhoneto7831 5 років тому

    Awesome! Right to the point!

  • @IQUBE
    @IQUBE 4 роки тому +2

    As a beginner, do you recommend using the QtDesigner or just hard coding? Thanks in advance!

    • @codywanserski9585
      @codywanserski9585 4 роки тому +1

      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!

  • @purduephotog
    @purduephotog 5 років тому +1

    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?

  • @sanasm3359
    @sanasm3359 3 роки тому

    can use pyqt5 for developing games

  • @王林-b7c
    @王林-b7c 4 роки тому +1

    Are there any requirements for the format of the picture? What format is the picture of that cat? I can’t use .jpg

  • @Mikosi
    @Mikosi Рік тому +1

    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 6 місяців тому

      Just change your .ui file (it should be saved) and then convert it to .py again

  • @alerproduction
    @alerproduction 2 роки тому

    I've got an error for the Pixmap, no images are being shown... AttributeError: 'Ui_MainWindow' object has no attribute 'setPixmap'

  • @sarveshkhandelwal6039
    @sarveshkhandelwal6039 5 років тому +3

    Can I add a GIF as the background for my window?
    BTW Great Content!

  • @yggyberry8133
    @yggyberry8133 4 роки тому +1

    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 4 роки тому

      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 4 роки тому +1

      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")

  • @theoneandonly2441
    @theoneandonly2441 9 місяців тому

    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?

  • @larcurie
    @larcurie 9 місяців тому

    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?

  • @BdyPhrk
    @BdyPhrk 5 років тому +1

    How can I rotate an image around give point ? Let's say like an arrow in a speedometer ?

    • @zx3215
      @zx3215 4 роки тому

      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

  • @user-cj3yu9nv1u
    @user-cj3yu9nv1u 5 років тому +1

    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.

  • @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?

  • @mehi99
    @mehi99 3 роки тому +1

    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 роки тому +1

      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

  • @marcoalban2105
    @marcoalban2105 3 роки тому

    Hi! Nice video. Do you know how to save the full image of the PyQt window?

    • @asHed0-0
      @asHed0-0 3 роки тому

      You could use Alt+prt sc(print screen) on windows and then paste it in paint or something like that

  • @sudheshhegde5090
    @sudheshhegde5090 4 роки тому

    Sir, can We play gif files from labels as we opened pictures? I tried to open but it didnt work out...Any other ways?

  • @yandere_lover-tl9zs
    @yandere_lover-tl9zs 4 роки тому +3

    Bro, how do i have the image in the background!?

    • @zx3215
      @zx3215 4 роки тому

      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...

  • @nawalhamed6394
    @nawalhamed6394 4 роки тому

    how to add video instead images? inside the label?

  • @shadoestorme
    @shadoestorme 4 роки тому

    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

  • @N10-b8f
    @N10-b8f 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

  • @petrockspiracy3120
    @petrockspiracy3120 4 роки тому +2

    Compared to using Page and tkinter this is like so easy to use it's actually ridiculous

  • @王林-b7c
    @王林-b7c 4 роки тому

    I can only use the png file, jpeg file is not allowed, why?

  • @MdMubin-bp7wp
    @MdMubin-bp7wp 4 роки тому

    Is it possible to view a multipage pdf file using PyQt5?

  • @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.

  • @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?!

  • @dhruvenkalpeshkumarparvati4874
    @dhruvenkalpeshkumarparvati4874 3 роки тому +1

    My image is not showing after compiling.......please help!!!!!!!!!!!!! @TechWithTim

  • @krishnapoddar76
    @krishnapoddar76 4 роки тому

    pls make a video on how to add animation to the gui in the qt designer pls pls

  • @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.

  • @farsear3403
    @farsear3403 4 роки тому

    hey ! how convert this to exe with pictures in --onefile

  • @pythonocean7879
    @pythonocean7879 5 років тому +1

    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 😘😘

  • @SPQRxUSAxNUSA
    @SPQRxUSAxNUSA 4 роки тому

    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. :(

  • @ggscreation4033
    @ggscreation4033 5 років тому

    Can you plse give a flowchart of python programming

  • @unknownman5296
    @unknownman5296 4 роки тому

    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

  • @bediosoro7786
    @bediosoro7786 5 років тому

    how to zoom in

  • @sainco3036
    @sainco3036 5 років тому

    thanks.

  • @pythonocean7879
    @pythonocean7879 5 років тому

    play with css in PyQt5

  • @christiandeinla8101
    @christiandeinla8101 5 років тому

    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.