If you are running as a root user while opening a GTK session on Linux i.e. using
su, etc, you might encounter errors like:
No protocol specified /usr/lib64/python2.7/site-packages/gtk-2.0/gtk/__init__.py:57: GtkWarning: could not open display warnings.warn(str(e), _gtk.Warning) No protocol specified Unable to initialize gtk: could not open display, falling back to console.
This occurs generally due to Wayland. The root user does not have permissions to run programs in the current session.
xhost + local: to allow other users (including root) to run programs in the current session.
Try running your program again now, it should work! 🎉