Reputation:
My code works just fine, but I get this warning in the terminal when I run the script. What am I missing?
abc.py:10: PyGTKDeprecationWarning: Using positional arguments with the GObject constructor has been deprecated. Please specify keyword(s) for "label" or use a class specific constructor. See: https://wiki.gnome.org/PyGObject/InitializerDeprecations
actor_act = Gtk.Button("Click Here")
Name of the script: abc.py
Actual code:
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
def actor(button):
print('Simple Button')
boxy = Gtk.Window(title="Hello")
boxy.set_default_size(500,500)
actor_act = Gtk.Button("Click Here")
boxy.add(actor_act)
actor_act.connect("clicked", actor)
boxy.connect("destroy", Gtk.main_quit)
boxy.show_all()
Gtk.main()
Upvotes: 2
Views: 1494
Reputation: 7206
Gtk.Button:
class: new_with_label (label)
Creates a GtkButton widget with a GtkLabel child containing the given text.
Parameters: label #The text you want the GtkLabel to hold.
Returns: The newly created GtkButton widget.
Gtk.Button.new_with_label("Click Here")
Upvotes: 7