JavaFX WebView #646
Replies: 4 comments 3 replies
-
I like this! Thank you, glad you are experimenting with this. And this reminds me that I should update the homepage. I don't think it should still say that py5 is a "new version of Processing", as it has been publicly available for a few years now. |
Beta Was this translation helpful? Give feedback.
-
I intend to continue using this technique. I did not realize that PSurfaceFX already had a root pane that could be accessed. It makes good sense to just use that pane in the default window instead of creating a separate new window with its own pane. The only downside that I see is that the Processing author chose to use a StackPane and I personally prefer just a 'regular' Pane so that I can position controls wherever I want with setLayoutX() and setLayoutY(). It remains to be seen if I can convince the new authors to allow the user to choose their own layout pane rather than being constrained to the StackPane with CENTER alignment. The 'pro' to most of the layout panes (there are several available) is that they dynamically reposition the controls with window resizing whereas the 'regular' layout Pane is static and the controls stay wherever they were positioned. The 'con' to the dynamic panes is the user is stuck with whatever the engineers coded for. |
Beta Was this translation helpful? Give feedback.
-
That # Uses Imported mode for py5
from javafx.scene.web import WebView
def setup():
size(900, 600, FX2D)
window_title('JavaFX WebView')
global pane, webView
pane = get_surface().get_native().getParent()
webView = WebView()
webView.getEngine().load('https://py5coding.org')
pane.getChildren().add(webView) |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Demonstrates a JavaFX WebView in the default Processing window.
Output:

Beta Was this translation helpful? Give feedback.
All reactions