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

PyQt5 Tutorial - QMessageBox and Popup Windows

Поділитися
Вставка
  • Опубліковано 15 лип 2019
  • This tutorial will show you how to use and create message boxes with pyqt5. It will explain all of the methods associated with the QMessageBox class, like changing the default buttons, setting the window title, icon and more!
    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
    - QMessageBox PyQt
    - QMessageBox
    - PyQt Message Boxes
    - Popup Windwo PyQt5
    #python #pyqt5 #qtdesigner

КОМЕНТАРІ • 101

  • @mindcreativestudios4709
    @mindcreativestudios4709 4 роки тому +7

    I know that I am late the " | " is called a "pipe" --- thanks for the videos. New to Python and Qt -- learning a lot here. Thank you.

  • @migueldomingos4570
    @migueldomingos4570 4 роки тому +8

    Very good tutorial on PyQt5.This playlist is helping me a lot.

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

    In case this is useful to anyone else: I was having a hard time getting the Qmessagebox to center on the main window (rather than the screen.) I fixed this by inheriting from MainWindow when defining msg like so:
    msg = QMessageBox(MainWindow)

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

      wow good thank you.

    • @mirimomekiku7141
      @mirimomekiku7141 2 роки тому +1

      Thankyou so much for this, this is what I needed lmao.

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

    8:50 you can close all with one click. click right to window icon bottom and select close all.

  • @barunbasnet
    @barunbasnet 4 роки тому +11

    Man, why did I find this channel so late.

  • @AaronEstebanSEO
    @AaronEstebanSEO 3 роки тому +17

    You're really NOT supposed to edit the main .UI file that's generated by QT Designer. From my simple research, it's best to just import the .UI file into a new .py file instead of converting the .ui file into a .py file because you will need to continue editing the ui file or making changes to it and you don't want to keep exporting and overwriting it each time that you convert it. So the real way is to continue on by importing it instead. Then you'll be able to keep editing the main .ui file without making any changes to the main py file that you're using to import the .ui file.

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

    this is the best tutorial yet I have ever seen. So thanks
    TIA

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

    Man you are the coolest guy I have ever seen Thanks a lot. It is much easier to comprehend python with your videos.

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

    This series is straight to the point thank you man

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

    Wonderful video. your tutorials are just what I need to understand how PyQt5 works. kudos

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

    Super helpful, many thks

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

    Thank you for the very gud Tutorial! and the show_popup function you don't need a variable there only "msg.exec_()"

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

    Thanks for your efforts Tim.. please keep it up

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

    Man ! You Nailed Every details

  • @mohammedk.h.f3016
    @mohammedk.h.f3016 Рік тому

    Thanks. I wish you add LCD and how to display values on it.

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

    thank you for this. it's very detailed and informative.

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

    Thank you brother

  • @user-cj3yu9nv1u
    @user-cj3yu9nv1u 4 роки тому +7

    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.

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

    Great job Tim!
    You earned a new subscriber and I will share your channel to my friends for more subscriptions.
    Looking forward for more videos.
    Thanks

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

    You are awesome, solved my problem! thank you!

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

    I find this tutorial very inforamtive.

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

    Awesome Bro wish you success

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

    Thanks : merci beaucoups pour les bonnes leçons.

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

    The return value from msg.exec_() would be the state of the button right (OK button in this case)? How else would you know if the user clicked ok or closed the window

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

    Awesome tutorials Tim! Keep it up :):)

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

    I hope that this tutorial to have some continuation...
    so sad that it's just 8 episodes

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

    Why don't button match their position from msg.setStandardButtons? You typed "Cancel Retry Ignore", but in the window there are "Retry Ignore Cancel" (and "Ignore Cancel Retry" on my computer). Your "Show Details" button appears as the 3rd, mine does as the 1st.
    Also, my Cancel button has its letter C underlined and can be pressed with C key, and the program prints "&Cancel" in the terminal when I press it.

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

    8:10 how come when you are calling the function self.popup_button you don't need to use a lambda function in order to pass an extra parameter (the button itself) like you showed in a previous video?

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

    Thank You great video

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

    thanks to help me :)

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

    How do you get each button to do different things?

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

    Brilliant Thankyou

  • @arsenkhachaturov8282
    @arsenkhachaturov8282 6 місяців тому +1

    How do I close a message box without the whole application crushing? Pyqt5

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

    After I translate the ui file into python, and I write code in it, but how can I transform back to an ui file where I can still edit it with all my code saved?

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

    Thank you Sir

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

    Which one is better? this or kivy?

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

      I have used kivy and prefer this way over that

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

    I wanna thank you for the videos They are very useful for community I was wondering if you are going to make video about tts and stt..

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

    Nice tutorial, I think, we can leave x variable also right, if exec_() shows the pop-up, cuz I don't think we need to store any data in x🤔

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

      actually the _exec() method returns an int code that shows which button was pressed .. so for each button type there is an unique code. so the x variable is there to save the returned code.

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

      @@deiaabdullah2008 yes, but I don't think we need to use that data...

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

    Hi Tim,
    I am trying to do a small software for ecommerce in which will have inventory, picking, packing, despatch, users...would you recommend PyQt5 for this or have any other suggestions?
    Great content, keep it up (Y) !

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

      pls tell me which path you would recommend now after 2 years as you may have experience now

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

    is PyQt5 easier that kivy ? and if i want to get values and run operators on it with is easier to use ?

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

    Hi Tim I Love Your Videos I Just Wanted To Say Please Make Roulette Game In Python In A Live Stream

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

    Damn i was too late to subscribe to your channel. I hope it gathers steam in the coming days. Keep the videos coming and all the best

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

    Hi,
    Is it possible to add the rows and column dynamically ? Can you Please make a video about QTableView. especially for matrix operation like multiplication

  • @sankethb.k642
    @sankethb.k642 5 років тому

    Thank you

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

    Very nice 👌👌

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

    I use VScode. and 3:42 when i type 'cri...' a context menu? appears. And it recommends 'critical' not 'Critical' but when i compileed? the program. it didn't work. When 'Critical' then worked

  •  2 роки тому

    How can i add line edit on message box?

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

    I'm having a problem where my window closes every time i click the button what should i do

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

    How can i create an Output code in pyqt5 ? I need to see the output codes in interface after pack to .exe

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

    Can i use tkinter messagebox instead pyqt5? In tkinter we can 100x easier show a warning or error box.

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

    Hi, i ran into the following issue when i tried to import the lib: "No name 'QMessageBox' in module 'PyQt5.QtWidgets' "
    Does anyone know how to fix it?

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

      I got the same thing but then noticed a syntax error in my typing. You get that error when you paste in this line?
      from PyQt5.QtWidgets import QMessageBox

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

      @@BoDuke73 i still get the same error, i don't know if it involves something with the version...

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

    Why when I create a simple message box, run the program, box shows up and then I pressing OK and... whole program crashing. Code is similar that yours...

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

    thanks.

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

    Can we make like a bigger popup? Like a menu or smth?

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

    I have this problem: "module 'PyQt5.QtGui' has no attribute 'QMessageBox'"! Can someone help me?

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

    he is creating each video of the tutorial series in a totally new place. I wonder how rich he is.

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

    How do I change the position of buttons inside message pop-up box? I tried searching for it online but to no avail. Can anyone help?

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

    I did this and have small problem, when I click cancel in the popup window, the python shell prints "&Cancel", in the other buttons no problems. Thanks in advance. I have subscribed your channel

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

      The ampersand (&) serves as the shortcut symbol; so in the UI the first C of Cancel should be underlined.

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

    I'm wondering how to use the exit button to exit the message box
    any answers please???

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

    i copy the same text you out in this tutorial but an error message pop up says " line 10 in from PyQt5.QWidgets import QMessageBox "
    moduleNotFoundError: No module named 'PyQtf.QWidgets'

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

    "|" -> pipe symbol

  • @user-wh9vc5he4t
    @user-wh9vc5he4t Рік тому

    Can sb explain how popup_button function "understands" where to take data for parametr clicked_button?
    because we don't put any parametrs when connecting this function
    msg.buttonClicked.connect(self.popup_button)
    I understand that we can't use brackets and if we like to pass parameters we should use lambda instead.
    But here we just do nothing and parametr is passed inside popup_button function...
    Confused...

    • @user-wh9vc5he4t
      @user-wh9vc5he4t Рік тому

      if this i is passed "by default" as extra parameter when you click the button, then where can I read about this in documentation?

    • @user-wh9vc5he4t
      @user-wh9vc5he4t Рік тому

      And also btw popup_button(self, i) doesn't work properly with detailed text button - no reaction on click :(

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

    Thanks for this video. However, it does not seem practical for this reason, especially for Questions. Wherever an issue arises (e.g. "file not found"), need to resolve that issue in a unique way Where the issue arises, not in Dialog code. Issues found elsewhere (e.g. "name is missing") have other reactions. I've seen in other languages something like "If reply == 'yes' do A, else do B". The reply is returned from Dialog box code. The reactions A and B may be different with each issue. We shouldn't need separate Dialog boxes for each issue. Does PyQt5 not have the return value or does your video not include this for some reason?

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

      Here is sample code to use at point of issue: reply = QMessageBox.question(self, 'title', 'issue question? ',QMessageBox.Yes, QMessageBox.Cancel,)
      then on next line: if reply == Qtw.QMessageBox.Yes: do A. EDIT: This does not use the show_popup function in your video.

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

    Hi Tim, I was doing a login system and I want to pop up this Qmessage if the email is not matched. The function does work, but for how many times (let's say 4) i click login button with wrong email, the function seems to remember it and once i successfully logged in, the message box will show that many times (in this case 4).
    Is there any way to solve this issue?
    Thanks

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

      You should store how many times the user failed in a variable(or in a file if you want the value to be kept when you run the program any time)

  • @Roy-wk5gy
    @Roy-wk5gy 4 роки тому

    Is there a site where I can view all the commands that Tim is explaining to us? I googled it but I couldn't find anything

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

    Hi Tim can i build professional android app with out java just on python

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

      Try kivy, but python is not the best language for android apps

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

    ERROR: Could not find a version that satisfies the requirement pyqt5-tools (from versions: none)
    ERROR: No matching distribution found for pyqt5-tools
    this is the error i am getting, when i tried to install this.
    I am using Ubuntu 18.04, python 3.7.3, and pip 19.1.1
    i also tried to search about this problem, i came to know that, this pyqt5-tools only supports windows not for linux.
    Can u suggest me some other. what should i do? i am not going to windows for this. any help will be useful.

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

      It's a bit different for Ubuntu:
      gist.github.com/ujjwal96/1dcd57542bdaf3c9d1b0dd526ccd44ff

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

    give ya a 2 thumber.
    Do you have / or know how to load images from url? I cant seem to find a straight forward way to do so in PyQt5. I can do it with tkinter but I want to user PyQt5 to build my interface. I really want to stick with pyqt if at all possible.

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

    anyone having error with self.button.clicked.connect(show_popup), stating show_popup not defined? I have the method verbatim to this tutorial, but receiving error.

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

      got it to work with self.button.clicked.connect(self.show_popup). couldn't just pass show_popup as argument to connect.

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

    PyQt5 is much better than tkinter, man.

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

    I like how he completely ignores the warning message to not edit the file :D
    He is going to cause a lot of people shoot themselves in the foot when they accidentally overwrite their work.

  • @user-rl5ej6og4e
    @user-rl5ej6og4e 29 днів тому

    sorry..자막이 없습니다.ㅠㅠ

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

    or even your email

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

    python has stopped working ._.

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

    5:20 Mine looked kinda like this
    H MyPPHard X
    MyPPHard
    (X)
    -----------------------------------------------------------------------------------------------------------------------------
    |Yes| |Ok| |Save| |Open| |Retry| |Ignore| |No| |Abort| |Close| |Cancel|

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

    not is a meme seriously

  • @user-yb2cx1ej8b
    @user-yb2cx1ej8b 4 роки тому

    Говорил бы, ты по русски - цены бы тебе не было👍🏻