sebp / PyGObject-Tutorial

Tutorial for using GTK+ 3 in Python
https://python-gtk-3-tutorial.readthedocs.io/
GNU Lesser General Public License v2.1
393 stars 161 forks source link

Fix deprecation warnings #156

Closed cas-- closed 2 years ago

cas-- commented 5 years ago

Fixes the PyGTKDeprecationWarning outputs in terminal, mostly related to positional arguments.

Added a make test command to quickly check that examples run and view output in terminal for deprecated warnings.

Fixes: #150, #78

cas-- commented 5 years ago

My reasoning for using new method is that it follows the GTK3 documentation as suggested in InitializerDeprecations

With GtkLabel it seems better to use new method rather than adding 'duplicate' attribute, plus it's two characters shorter ;)

Gtk.Label.new("Item 2")
Gtk.Label(label="Item 2")

Also it ties in with the associated method new_with_mnemonic:

Gtk.Label.new_with_mnemonic("_Item 2")

Another reason to avoid using the default class constructor with attributes is that Gtk deprecation warnings will be missed: https://github.com/sebp/PyGObject-Tutorial/pull/156#discussion_r295252363