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

Improvements to wx and qt #141

Merged
merged 4 commits into from
Mar 31, 2021
Merged

Improvements to wx and qt #141

merged 4 commits into from
Mar 31, 2021

Conversation

almarklein
Copy link
Collaborator

@almarklein almarklein commented Mar 31, 2021

  • Renamed wxpython.py -> wx.py (but the changes that followed make git forget it's the same file)
  • Can now instantiate wx.WgpuCanvas and it will work as a main frame or embedded widget.
  • Fix rounding in get_physical_size for pyqt6.
  • Add examples to demonstrate embedding viz in a gui, for qt and wx.

I also implemented request_draw() but it draws directly. This should be changed so the actual draw happens later, preferably rate-limited. I wanted to look into that, but for some reason I get a context lost when I try to run pygfx with a wx widget, so I'll leave this for another day/person.

@almarklein
Copy link
Collaborator Author

cc @Correct-Syntax

if parent is None:
return wx.Frame.__new__(WxWgpuFrame, *args, **kwargs)
else:
return wx.Window.__new__(WxWgpuWindow, *args, **kwargs)
Copy link
Collaborator

@Korijn Korijn Mar 31, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this dynamic inheritance? First time I ever see that implemented like this :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what it's called TBH. It creates an instance of a subclass, and the subclass depends on the input. Not entirely happy about this, see #142

@Korijn
Copy link
Collaborator

Korijn commented Mar 31, 2021

I wanted to look into that, but for some reason I get a context lost when I try to run pygfx with a wx widget, so I'll leave this for another day/person.

Do you mean this PR breaks the integration?

@almarklein
Copy link
Collaborator Author

Do you mean this PR breaks the integration?

No, it did not work to start with. (I just double-checked)

@Korijn
Copy link
Collaborator

Korijn commented Mar 31, 2021

OK, then we can merge. ;)

@almarklein almarklein merged commit 1e96aef into main Mar 31, 2021
@almarklein almarklein deleted the wx branch March 31, 2021 14:29
@Correct-Syntax
Copy link
Contributor

One of the problems I had mentioned (I was going to add a code comment about it, but decided not to): the Wgpu async main thing seemed to need to access the WgpuCanvas instance directly. Thus, the PR only really worked when you "know" ahead of time what part of the GUI is using WgpuCanvas.

main(path.to.someclassthatuseswgpu)

That wouldn't work for a widget, obviously.

@almarklein
Copy link
Collaborator Author

That should work now, I think, because both the widget and the frame implement the WgpuCanvas interface. But also see #142

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants