Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pyside6 backend raises exception AttributeError: module 'PySide6.QtWidgets' has no attribute 'QAction' #1279

Closed
manuel-koch opened this issue Nov 17, 2023 · 1 comment

Comments

@manuel-koch
Copy link

manuel-koch commented Nov 17, 2023

I'm using MacOS 14.1.1 (23B81) on Apple M1 Pro, conda environment

  • python 3.11
  • pythonocc-core=7.7.2
  • PySide6_Essentials=6.6.0

With the following minimal code I get a runtime error

from OCC.Core.BRepPrimAPI import BRepPrimAPI_MakeBox
from OCC.Display.SimpleGui import init_display

def _export_to_png(display):
    # save to other format by changing extension of filename
    display.View.Dump("./capture.png")

def minimal_display_shape_with_screencapture():
    display, start_display, add_menu, add_function_to_menu = init_display()
    box_shape = BRepPrimAPI_MakeBox(50, 30, 10).Shape()
    display.DisplayShape(box_shape, update=True)[0]
    add_menu("screencapture")
    add_function_to_menu("screencapture", functools.partial(_export_to_png,display))
    start_display()
  File "/source/simply_display.py", line 275, in minimal_display_shape_with_screencapture
    add_function_to_menu("screencapture", functools.partial(_export_to_png,display))
  File "/envs/lib/python3.11/site-packages/OCC/Display/SimpleGui.py", line 247, in add_function_to_menu
    win.add_function_to_menu(*args, **kwargs)
  File "/envs/lib/python3.11/site-packages/OCC/Display/SimpleGui.py", line 220, in add_function_to_menu
    _action = QtWidgets.QAction(
              ^^^^^^^^^^^^^^^^^
AttributeError: module 'PySide6.QtWidgets' has no attribute 'QAction'

It will run normally when I don't call add_function_to_menu.

@tpaviot
Copy link
Owner

tpaviot commented Nov 20, 2023

thank you for your feedback, fixed

@tpaviot tpaviot closed this as completed Nov 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants