PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, June 26, 2022

[FIXED] What is supported signatures and Union[]?

 June 26, 2022     compiler-errors, python-3.x, user-interface     No comments   

Issue

If you wish to see base line questions skip problem details and see summary

Problem Details

I'm not too familiar with gui programming but I'm trying to get the smach_viewer to work for a project I'm working on for my class in ROS noetic. I've resorted to pulling all of the source code and putting it my workspace which already makes it more manageable but while adapting the code in one of the python packages I ran into an error I can't make heads or tails of:

  File "/home/hawk/final_project_ws/src/final-project-group-4-inc/src/xdot/xdot_qt.py", line 1914, in main
    app.setWindowIcon(QIcon(":/icon.png"))
TypeError: 'PySide6.QtGui.QGuiApplication.setWindowIcon' called with wrong argument types:
  PySide6.QtGui.QGuiApplication.setWindowIcon(QIcon)
Supported signatures:
  PySide6.QtGui.QGuiApplication.setWindowIcon(Union[PySide6.QtGui.QIcon, PySide6.QtGui.QPixmap])

Above its saying that the function setWindowIcon has a supported signature, which is something I've never seen before. And within the supported signature it says that the parameter for the function looks along the lines of this: Union[QIcon, QPixmap](<-- summarized form). I've never seen Union[] thing before so that is new to me as well.

Summary

  1. What is this error telling me?
  2. What is a Supported Signature?
  3. What is a Union[] supposed to be within parameters as shown in the suggested signature of the error?

Solution

So I found out supported signatures specifies what objects you can pass into a parameter.

Union is another way of saying the parameters should be this object or the other.

So the supported signature: PySide6.QtGui.QGuiApplication.setWindowIcon(Union[PySide6.QtGui.QIcon, PySide6.QtGui.QPixmap]) Is saying that function PySide6.QtGui.QGuiApplication.setWindowIcon() accepts an object of type Pyside6.QtGui.QIcon or PySide6.QtGui.QPixmap.



Answered By - K.Griffith
Answer Checked By - Robin (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing