Python GTK3 inheritance -


How can I get GTK + 3 class in Python? I am trying to create a legacy class of Gtk.Application and what I have found is a segfault.

I have tried a lot of things, but with this I got a segfault:

  class program (Gtk.Application): def __init __ (self): super () .__ init __ (self) ... PRG = Program.new ("APP_ID", flags)    "post-text" itemprop = "text"> 

If I try my code snippet, I actually get:

  traceback (most recent call final): In the file "pyclass.py", line 12, & lt; Module & gt; PRG = Program.new ("APP_ID", 0) Writing Error: Application Maker can not be used to create examples of a subclass program   

Which is expected, since you call Python Using the code for gtk_application_new () should try the Program.new ()

python manufacturer form. class program (Gtk.Application): def __init __ (self): Gtk.Application .__ init __ (auto, APPLICATION_ID = "org.example.Foo", flags = Gio.ApplicationFlags .FLAGS_NONE) PRG = Programs () sys.exit (prg.run (sys.argv));

This will actually warn you that you have not implemented the GApplication :: activate virtual function, which can be achieved by overriding the do_activate Virtual method in your program class:

  class program (Gtk.Application): def __init __ (self): Gtk.Application .__ init __ (self, APPLICATION_ID = "org.example.Foo", flags = Gio.ApplicationFlags.FLAGS_NONE) Def do_activate (self): print ("active!")   

this will print < code> active Console, before leaving.

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -