-
-
Notifications
You must be signed in to change notification settings - Fork 21
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
Uncaught TypeError: Unsupported type: function #53
Comments
Here's an example for passing JS functions to Python land: Line 283 in 025e9da
|
Nice this works indeed import { NamedArgument, python } from "https://deno.land/x/python@0.4.1/mod.ts";
const gi = python.import("gi");
gi.require_version("Gtk", "4.0");
const Gtk = python.import("gi.repository.Gtk");
const onActivate = python.callback(
// deno-lint-ignore no-explicit-any
(_kwargs: any, ...args: any[]): undefined => {
const app = args[0];
const win = Gtk.ApplicationWindow(new NamedArgument("application", app));
win.present();
},
);
const app = Gtk.Application();
app.connect("activate", onActivate);
app.run(); |
@DjDeveloperr I'm following this tutorial https://github.com/Taiko2k/GTK4PythonTutorial and this is what I reached so far import { NamedArgument, python } from "https://deno.land/x/python@0.4.1/mod.ts";
const gi = python.import("gi");
gi.require_version("Gtk", "4.0");
gi.require_version("Adw", "1");
const Gtk = python.import("gi.repository.Gtk");
const Adw = python.import("gi.repository.Adw");
class MainWindow extends Gtk.ApplicationWindow {
constructor(kwargs) {
super(kwargs);
// question about this part
const button = Gtk.Button(new NamedArgument("label", "Hello"));
this.set_child(button);
}
}
class MyApp extends Adw.Application {
// deno-lint-ignore constructor-super
constructor(...kwargs: any) {
super().__init__(kwargs);
this.connect("activate", this.onActivate);
}
onActivate = python.callback((kwargs, ...args) => {
const app = args[0];
const win = new MainWindow(new NamedArgument("application", app));
win.present();
});
}
const app = new MyApp(new NamedArgument("application_id", "com.example.com"));
app.run(Deno.args); There are porbably other issues, but the immediate one I have is const button = Gtk.Button(new NamedArgument("label", "Hello"));
this.set_child(button); if I change
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The text was updated successfully, but these errors were encountered: