Це відео не доступне.
Перепрошуємо.

PyQt5 Tutorial - MenuBar (Shortcuts, Status Bar and Triggers)

Поділитися
Вставка
  • Опубліковано 18 сер 2024
  • This pyqt5 tutorial will show you how to create menubars with qt. We will be adding shortcuts, status bar hints and triggering functions to run when certain menubar items are pressed.
    Text-Based Tutorial: techwithtim.ne...
    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.....
    📸 Instagram: / tech_with_tim
    🌎 Website techwithtim.net
    📱 Twitter: / techwithtimm
    ⭐ Discord: / discord
    📝 LinkedIn: / tim-rusci. .
    📂 GitHub: github.com/tec...
    🔊 Podcast: anchor.fm/tech...
    💵 One-Time Donations: www.paypal.com....
    💰 Patreon: / techwithtim
    ◾◾◾◾◾◾
    ⚡ Please leave a LIKE and SUBSCRIBE for more content! ⚡
    Tags:
    - Tech With Tim
    - Python Tutorials
    - PyQt5 Tutorial
    - PyQt5 Menu Bar Tutorial
    - Menubars PyQt5
    #python #pyqt5 #pythongui

КОМЕНТАРІ • 113

  • @fbq
    @fbq 5 років тому +36

    first Like And Comment :) xD

  • @Stagedrengen
    @Stagedrengen 4 роки тому +53

    I know I'm a little late to the party here, but I just wanted to let you know that you're doing God's work with these tutorials. You keep them short and simple, no mumbling or rambling, and one can easily understand what's going on. Super impressive :)

  • @ruslan.zhumabai
    @ruslan.zhumabai 4 роки тому +2

    You have opened my dream which I have thought for creating the App a long time ago. I just wanted to make a software which is able to connect with an Arduino board. Thank you it is so understandable. I will watch all your videos in the quarantine time. Sorry for my English if it is incorrect. I am from Kazakhstan.

  • @davidgrove1600
    @davidgrove1600 5 років тому +8

    YOU ROCK! Keep going with PyQt!
    May offer a suggestion? Plan your UI, name every object that you want to access using code as you go along. It should be the first thing you do. However, you do not need to name items that you will not be accessing codes (ex.: labels). Maybe a suggestion for a short video?

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

    I have to say that you are very well spoken, and mild-mannered. Please keep the videos coming!

  • @CarlosGarcia-di3kn
    @CarlosGarcia-di3kn 4 роки тому +1

    I am new to python and QT designer, your video is great help. Thanks Man

  • @vxsniffer
    @vxsniffer 4 роки тому +3

    another way to pass arguments to assigned functions (without calling them instantly) is partial function (from functools import partial)
    example assignment would look like:
    self.actionNew.triggered.connect(partial(self.clicked, ‘New was clicked’))
    for this purpose both methods work the same, but some advanced cases may favour partial function... it's not redundant to lambda ;-)

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

    Thanks for the tutorial. It helped A LOT. Some other QT tutorials on YT are over 5 years old and cause newbs like me major confusion. This series is very helpful.

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

    Bro, you always make it look easy, that's awesome

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

    Thx for lambda explanation!

  • @rfresh1011
    @rfresh1011 3 роки тому +8

    To clarify, once you generate the .py code and you start to make manual edits to it, you cannot go back and use the QTDesigner again and re-generate the .py file because it will wipe out all of your manual changes...correct?

    • @brunonkowalski
      @brunonkowalski Місяць тому

      Yes, that's why you should never edit this file.

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

    This is the 3rd video I'm watching. Great videos man, I love the effort you put into making every step clear but not overwhelming for newbies! Keep up the good work :)

  • @ashish2099
    @ashish2099 Рік тому

    God bless you brother. I love your tutorials so far. To think you're giving us such an amazing information for free at the expense of your own time, man you're simply amazing. Thank you brother, I'll be forever grateful

  • @paccooper3019
    @paccooper3019 Рік тому

    Thank you! I always find your tutorials to be really helpful, you explain everything really good

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

    good job Tim!! everything is clear. Thank you

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

    Simple and easy to understand tutorials. Thanks Tim...

  • @zjason7582
    @zjason7582 2 місяці тому

    Good job! Really helpful for beginners!

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

    Awesome tutorials on qt. I was struggling to understand from other people on youtube and on web and I like your approach of going from basic and building up bit by bit. Keep them coming.

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

    Having dyslexia and being completely new but obsessed with all of this is overwhelming. That and being the African American athlete all my life has me completely lost with programming. You give me hope bro and the comments, but I am lost, guys. Not too many look like me and I'm far behind.
    But since I can't create anything yet, I write my ideas and create the prototypes on Canva because I also can't design(learning figma now).
    I wish there be a platform where "idea guy", "developer", "investor", "salesperson" connect as one.
    I'll share my ideas via email with anyone just to know if they are possible. I think they can change a lot of things in the world.

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

    Your tutorial is so clear and so helpful!!! Thanks!!

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

    Thanks for your time and share the knowledge

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

    Excellent tutorial and great explanation of the lambda function

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

    The Best tutorials ever, keep doing it!!!

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

    This guy is so freaking Canadian, it's wonderful

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

    Thank you... I finally understand lamba functions.

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

    this tutorial help me a lot! Thank you so much!

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

    amazing Tim, you the best

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

    Love that series! Is there also an easy ways to use shortcuts without the menu bar?

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

    Getting interesting more and more...
    💯💯💯💯

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

    I'm (py)charmed by this tutorial

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

    Great Video! Thanks a lot

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

    Thanks, Tim. Subscribed.

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

    Thank u so much

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

    thx,tim,very helpful

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

    Though You keep being effective sometimes You're unpatient and immediately after having typed the last letter then jumping to the next topic. Else You're diong a great support.

  • @addictivelearning6153
    @addictivelearning6153 5 років тому +2

    Hey can you upload everything about qt rapidly pls and you are making best content so keep it up

    • @TechWithTim
      @TechWithTim  5 років тому +2

      That’s kind of asking a lot, but I appreciate your compliment !

  • @a.sam.2714
    @a.sam.2714 2 роки тому

    Very nice tutorial, thank you. But in the code you do not import created gui file from QT, but rather create everything programmatically.

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

    Amazing video

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

    Keep it going!

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

    Thanks!

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

    great videos

  • @user-bc2ec6dg4e
    @user-bc2ec6dg4e 5 років тому

    Thanks a lot

  • @thetrinitysolution9631
    @thetrinitysolution9631 Рік тому

    Tim, your tutorial worked flawlessly on my dad's PC. But when I try to create the ".py" file using the Mac terminal, it says "Command not found." This is most likely because the path is wrong, and the ">" symbol is probably the issue. I've tried a number of substitutions without success. Would you know what the correct syntax is for the Mac or where I could go for that info? Thanks!

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

    Thanks Alot

  • @jstro-hobbytech
    @jstro-hobbytech 2 роки тому

    lambda is a compiler preprocessor directive isn't it?

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

    Hi, what if you wanted to attach to the events outside of the class? How would we do that? How do we raise events from outside of a class? I come from a .Net background. Very similar stuff i think.

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

    you rock!!

  • @fransflorenza9708
    @fransflorenza9708 Рік тому

    can anyone help me please? im kind a beginner. i want to use push button and detect whenever its have value true or false without toggled. i try to use set checkCheckable but it make the button toggled (not momentary)

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

    This is a little bit easier than hand coding a GUI via Tkinter. Just a little bit. :-)

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

    Tim, I'm just now looking at this video from 2019. So I don't know if you are monitoring for questions and comments. When I create menu items, they do not show up on the mainwindow as shown in your example. Instead, they show up at the top of the "Python" program that is running the code. Not sure how to explain it more clearly without providing you with a screenshot. The only thing that comes to mind as a possible cause is I am doing all this on a Mac using the very latest OS which is Big Sur. I know you do your work on a Windows PC. I wonder if you have seen this issue before and if you know what I need to do to make the code run properly. Thanks

  • @ChristopherBrown-bj4zl
    @ChristopherBrown-bj4zl 4 роки тому +3

    Anyone else seeing their program crash after clicking "new"? 'UI_MainWindow' Object has no attribute 'Clicked"

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

    Merci infiniment

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

    So happy to see some qt tutorials. Most of them are not that accurate or detailed. But why editing the generated ui. py file? If I will go to the creator again, and make changes there, convert it into a .py the changes made in the previous .py are gone. I usually define a class inheriting the Ui class and define all new properties there so I can change and reconvert the ui-file freely. Is there any reason not to do that?

  • @user-fi3fi7pu5l
    @user-fi3fi7pu5l 2 роки тому

    Hello Tim. Thanks for your nice video but I have an issues that all the Menubar do not show up. I check by preview in QtDesigner and also by running the python code. could you please help me if you see this comment

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

    thanks.

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

    I am Always quite confused About where to put the Action triggerd when we press something is it in retranslateUi OR in SetupUI ??

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

    Thanks for the tutorial. My problem with this approach is that many of the pillars of what define good development are not followed here. Code readability, proper code abstraction, and code revision are non existent. By which I mean, the code generated is messy, the code generated is not defined in separate functions or classes, and any new update to the GUI would require a weird work around. Do you have any recommendations to my concerns. Thank you. Awesome tutorials.

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

      The standard way to use is to import the GUI code in another python file and write the functional part there. That way when you change the GUI and regenerate code you don't lose the functionality of the app.

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

    Hi, Tim. When I opened my .py file in Sublime, I found that I was missing the "if" from your lines 71-78. What can I have done wrong? Thanks.

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

    Tim, kinda late but what if I wanna update my design? Will I lose all the methods that I made?

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

    Can we pass a text file as an argument instead of string text?

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

    This playlist is great, do you have any classes on udemy? or any other site

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

      I have a teachable course! Link in description

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

    Hello! I want to ask something.
    We have a "TextLabel" text in main window and when the programme ran, only half of the text was visible. So i wrote " def update(self):
    self.label.adjustSize()" after " font = QtGui.QFont()
    font.setPointSize(36)
    self.label.setFont(font)
    self.label.setObjectName("label")" to fix this problem, but it didn't work. What should i do to fix it?

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

    hey,
    can i use qt designer for free ?
    i build an app with pyqt5 code ( without the qt designer)
    what should be the right way to enable transition between the pages?
    now the app crash because i create new pages in other pages. should i do "manager" page which wrap the all pages ?
    thanks

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

    triggered.connect not working !!!!AttributeError: 'QPushButton' object has no attribute 'triggered'

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

      QPushButton.clicked.connect... Triggered is for the Menu item only

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

    can we just create the trigger in designer instead of coding?

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

    Hi, how are u, thank you for sharing your knowledge, sorry how can I call a new grafic interface from another after converting it to py. Or I mean, a create an interface, I converted it from ui. file to py file, an after that I wanto to call ather interface x from interface y a created before? Sorry for my broken English, Iam typing from Angola and here we speak Portuguese, I hope you undnerstand.

  • @mdakash-ns7vq
    @mdakash-ns7vq 4 роки тому

    what power Full Softwer Kivy or qt5?

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

    Why do you need the Lambda keyword? Wouldn't calling --> self.actionNew.triggered.connect( self.clicked( 'foo'))

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

    Hello, when converting from .ui to .py code, then running the .py code in Jupyter notebook, the code will not run, and says "Not Responding"
    Why is this?

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

      Now running the code in Sublime Text as per the video and the response is:
      This application failed to start because it could not find or load the Qt platform plugin "windows"
      in "".
      Available platform plugins are: minimal, offscreen, windows.
      Reinstalling the application may fix this problem.
      [Finished in 3.3s]
      Any help

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

    How do you deal with the case where you go back to QTDesigner to make further changes, and pyuic5 overwriting your tutorial4.py that you modified manually? I think you probably want the manual changes made into a separate file with a class that derives from UIMainwindow, and to which you can make manual changes without worrying about UIMainwindow being erased?

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

      You can separate the UI file from the Python file by importing the uic module and then load your .ui file with uic.loadUi('')
      In the window variable you can then address the different UI Components like e.g. window.button1.clicked.connect()
      import sys
      from PyQt5 import QtWidgets, uic
      app = QtWidgets.QApplication(sys.argv)
      window = uic.loadUi('test.ui')
      window.show()
      app.exec()

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

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

    How to embed pyqtgraph to qtwidget?
    Video?

  • @MediaGrizzly.
    @MediaGrizzly. 3 роки тому

    If you click form and go down to view python code you can skip the cmd step

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

    I'm getting a TypeError too many arguments with the self.label.adjustSize

  • @MrDksmall
    @MrDksmall 7 місяців тому

    I didn't see anything about the status bar, did I miss something?

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

    I thought it would be a PyQT 5 tutorial as it says on the title but it was more of a Qt Designer Tutorial with pyqt as a back end. :( I got confused between Menubars and Menus but i figured it out in the end after reading the API. Just got click baited I guess \O/

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

    Why is there self before every single thing?

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

      thats how OOP in python works, they pass around a reference of the object in the methods, its like 'this' in other languages

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

      @Mr_Relaxing yeah thats what i said.

  • @user-ol5bj4dm2v
    @user-ol5bj4dm2v 3 роки тому

    Note: if you're on macOS, you will not see menubar on the actual window, but on the top of the screen instead.

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

      Again on macOS, the status tip text is not displayed anywhere (that I've found yet)

    • @ilusions4
      @ilusions4 Рік тому

      LOL! Thank you so much. I've been making a cross-platform program and this has been driving me insane for 3 days. I've never used a mac in my life (only linux and windows), so I didn't think to look there.

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

    11:00 does anyone understand why the code errors out if you dont use "lambda:" ?

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

      Same question here...

    • @jonasgames5476
      @jonasgames5476 4 роки тому +3

      IDK but if you use lambda: without upper L it works for me

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

      Here is the reason:
      The connect method requires a name of the function to connect to.
      If you pass clicked('xyz') ---> It means you are calling the function 'clicked' with 'xyz' as argument and the 'return value' of clicked will be passed to connect.
      Hence the error!

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

      @@jonasgames5476 Thank you so much. You inadvertently helped me fix my code. self.actionNew.triggered.connect(Lambda: self.clicked("New was clicked")) was not working. However, when "Lambda" is lowercase "lambda," it works. Again, I appreciate it.

    • @Life-History2515
      @Life-History2515 Рік тому

      @@jonasgames5476 THANK YOU!!

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

    Finally!

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

    second 💕💕

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

    Why would anyone do dev work in windows? Doesn’t make sense. Also, you do know windows10 spies on you. Privacy is important to me.

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

      I’ve got nothing to hide!

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

      Haha. Do you use mac or linux? What distro? I'm on w10 also i am considering to switch to linux.

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

      Why would anyone do dev work in linux? Doesn't make sense. Also, do you know that IRC hates you, and Linux wants you to be unsocial? Health is important to me. :D

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

      Kristy Whalen I see what you did there. Not funny. Lol.

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

      @@kristypolymath1359 haha