Re: TypeError in GtkWindow



On 10/09/2015 09:25 AM, Felipe Borges wrote:
As mentioned by Stefan, Coor2MASS was expecting a GtkWindow (the
parent window), and you are passing a TitleBar object.

Try something like this:

diff --git a/q2MASS.py b/q2MASS.py
index 43af88c..6b6a6d7 100644
--- a/q2MASS.py
+++ b/q2MASS.py
@@ -37,7 +37,7 @@ class Query2MASS(Gtk.Window):
          self.set_border_width(10)

          # add headerbar
-        tb = TitleBar()
+       tb = TitleBar(self)
          titlebar = tb.headerbar()
          self.set_titlebar(titlebar)

@@ -62,7 +62,9 @@ class Query2MASS(Gtk.Window):
  class TitleBar:
      """Create the header bar"""

-    def __init__(self):
+    def __init__(self, parent):
+        self.parent = parent
+
          """Initialize the class"""
          # create left and right headers
          self.left_header = Gtk.Grid()
@@ -131,7 +133,7 @@ class TitleBar:
      def on_button_coor_clicked(self, widget):
          """Close popover and show Coordinates options"""
          self.popover_opts.hide()
-        coor = Coor2MASS(self)
+       coor = Coor2MASS(self.parent)
          resp = coor.run()
          if resp == Gtk.ResponseType.OK:
              print("Clicked OK!")

Hi Felipe,

That really worked! Thank you for your time!

All the best,
Germán.

--
Germán A. Racca
Fedora Package Maintainer
https://fedoraproject.org/wiki/User:Skytux


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]