PySide6 Tutorial | Qt 6 For Python | Loading UI Files Created with Qt Designer

Поделиться
HTML-код
  • Опубликовано: 1 ноя 2024

Комментарии • 34

  • @gokulrajaking
    @gokulrajaking 3 года назад +3

    Great tutorial. Thanks for introducing PySide6 in YT

    • @tuxcodes
      @tuxcodes  3 года назад +1

      Our pleasure!

    • @dnrbs2168
      @dnrbs2168 3 года назад

      Can you help me solve the below error
      Error is pyside6-uic : The term 'pyside6-uic' is not recognized as the name of a cmdlet, function, script file, or operable
      program.
      While translating the UI file to Python file

    • @alexandarjelenic7718
      @alexandarjelenic7718 3 года назад

      @@dnrbs2168 Try to just load the .ui directly.instead of converting to .py
      Class my_program(QMainWindow)
      def __init__(self):
      QMainWindow.__init__(self)
      my_ui='my_ui.ui'
      self.setWindowIcon(my_logo)
      uic.loadUi(my_ui,self)

  • @mrmartinwatson1
    @mrmartinwatson1 3 года назад +3

    man this is underrated, every video i clicked on to explain pyslide6 immediately defaulted to qt and qt quick. Like i clicked for pyslide, where is it!

    • @lyleandres1510
      @lyleandres1510 3 года назад

      You probably dont give a damn but does anyone know of a way to log back into an instagram account..?
      I was dumb forgot the login password. I would love any tips you can offer me.

    • @mrmartinwatson1
      @mrmartinwatson1 3 года назад

      @@lyleandres1510 you may be able to request a login if you remember the gmail or phone number. Other wise ya can call up there to instagram if you have anything else like a secondary phone number or know the hidden questions if u had any.

  • @e1nste1in
    @e1nste1in 3 года назад +2

    Good video! Would be great to have another one about dynamically loading the *.ui file in Python.
    I especially struggle there to get sufficient typing support from the editors.

  • @irfanhazza
    @irfanhazza 2 года назад +1

    is there no continuation to this great tutorial series :(

  • @alexandarjelenic7718
    @alexandarjelenic7718 3 года назад +2

    this is a nice video. But keep in mind that you are not using the uic.load() function within python. You are creating a .py output. If you really want to "load ui files created in Qt designer" then do this:
    Class my_program(QMainWindow)
    def __init__(self):
    QMainWindow.__init__(self)
    my_ui='my_ui.ui'
    self.setWindowIcon(my_logo)
    uic.loadUi(my_ui,self)
    This save the step, of converting the ui to py and that way if you change anything in the .ui you dont lose your work!

    • @tuxcodes
      @tuxcodes  3 года назад

      That is a good point! I will do another video addressing that specifically. Thanks for the pointer!

    • @tuxcodes
      @tuxcodes  3 года назад +1

      I would also like to point out the tradeoff between the two methods. Both are completely valid, but loading the UI file directly instead of converting with UIC adds a little memory and computation overhead to the application. For small programs this isn't an issue, but for larger applications it can cause performance issues.

    • @josys363
      @josys363 2 года назад

      @@tuxcodes This is true and you also lose the automatic code completion that IDEs like PyCharm provide.

  • @AlexanderPerez-oe1gu
    @AlexanderPerez-oe1gu 3 года назад +1

    Thank you for posting these tutorials! Amazing job and well explained. Will you be posting on the proper way to add logic to once you've made the connection to the UI files?

  • @codepower2935
    @codepower2935 3 года назад +1

    Thanks for sharing the tutorial, was really helpful, could you make a tutorial on how the qanimationproprety works, thanks again.

    • @tuxcodes
      @tuxcodes  3 года назад

      Great suggestion!

  • @flavioperini2484
    @flavioperini2484 3 года назад

    this was SO useful, thanks man

  • @girlsandfunny
    @girlsandfunny 2 года назад

    Hi, very appreciate about the video but when I running the code in your vedio I got error "from ui_mainwindow2 import Ui_MainWindow
    ValueError: source code string cannot contain null bytes", may I ask how to solve that. Thank you.

  •  3 года назад

    Nice :) we need more definetly.

  • @Skateforeva121
    @Skateforeva121 3 года назад +1

    Traceback (most recent call last):
    File "C:/Users/Bryan/PycharmProjects/FirstProject/main.py", line 3, in
    from ui_mainwindow import Ui_MainWindow
    ValueError: source code string cannot contain null bytes
    #The file converted successfully and stored inside/next to main.py but I'm receiving this error?

    • @Skateforeva121
      @Skateforeva121 3 года назад +4

      This bug(?) only occurs when pyside6-uic is run in powershell and the output is redirected to a file.
      If using powershell use the -o option to specify an output file. Both methods work fine from a normal command prompt.
      pyside6-uic mainwindow.ui > ui_mainwindow.py
      Instead
      pyside6-uic mainwindow.ui -o ui_mainwindow.py

    • @Jamie_Allan
      @Jamie_Allan 2 года назад

      Thank you @@Skateforeva121!

    • @naseefo
      @naseefo 2 года назад

      @@Skateforeva121 Thanks, it works!

  • @cyrilcalmes4208
    @cyrilcalmes4208 2 года назад

    It does not work on my PC. Using Python 3.9, PySide6 and Qt Designer 5.11.1. I have this error.
    File "e:\PYTHON\Qt_PYTHON\main.py", line 3, in
    from ui_mainwindow import Ui_MainWindow
    ValueError: source code string cannot contain null bytes

  • @UnbiasedYT
    @UnbiasedYT 3 года назад

    Fortnite fan eh? Nice video tbh! Keep it up.

  • @dnrbs2168
    @dnrbs2168 3 года назад

    Hey Thanks for Tutorial
    Getting Error while Converting the Ui file in python file
    Error is pyside6-uic : The term 'pyside6-uic' is not recognized as the name of a cmdlet, function, script file, or operable
    program.
    Plz Help

    • @tuxcodes
      @tuxcodes  3 года назад +1

      Are you running it inside a venv with pyside6 installed? Or did you install pyside6 globally? Also, what operating system are you running on?

    • @dnrbs2168
      @dnrbs2168 3 года назад

      @@tuxcodes Hi Thank you for response.
      It is inside a venv with pyside6 installed. On Windows10-operating system, and Editer is PyCharm CE.
      While Translating the UI file with PyCharm throwing error as
      (venv) I:\AABBCC_ENV>pyside6-uic romi.ui > ui_romi.py
      ** On entry to DGEBAL parameter number 3 had an illegal value
      ** On entry to DGEHRD parameter number 2 had an illegal value
      ** On entry to DORGHR DORGQR parameter number 2 had an illegal value
      ** On entry to DHSEQR parameter number 4 had an illegal value
      While Using PowerShell thrown the error as: pyside6-uic : The term 'pyside6-uic' is not recognized as the name of a cmdlet, function, script file, or operable
      program.

    • @dnrbs2168
      @dnrbs2168 3 года назад

      @@tuxcodes I solved the problem by Uninstalling latest Numpy-1.19.4, and installed numpy-1.19.3 on Windows10.

    • @alexandarjelenic7718
      @alexandarjelenic7718 3 года назад

      here is no need to convert the ui to python. If you really want to "load ui files created in Qt designer" then do this:
      Class my_program(QMainWindow)
      def __init__(self):
      QMainWindow.__init__(self)
      my_ui='my_ui.ui'
      self.setWindowIcon(my_logo)
      uic.loadUi(my_ui,self)