Taiko2k / GTK4PythonTutorial

GTK4 + Python tutorial with code examples
446 stars 33 forks source link

Adw.AboutWindow codeblock explaination #22

Open MadameMalady opened 1 year ago

MadameMalady commented 1 year ago

in the 'Better About Window' tab, you showcase some code for an adwaita AboutWindow, but (unless I missed it, and I checked code examples) I can't find a complete usage example of that, and the documentation isn't too much help since it's all for C....

Would you be willing to show an Adw.AboutWindow example that shows where the:      dialog = Adw.AboutWindow(transient_for=app.get_active_window())
and following line(s) are defined?

I was able to make an about window with the section for Gtk.AboutDialouge, but I don't understand the small 'dialog' snippets for the Adw.AboutWindow

Taiko2k commented 1 year ago

Just run that code when you want to show the about window, plus add the line dialog.set_visible(True). (Ive updated to code snippet in the tutorial with this)

MadameMalady commented 1 year ago

Okay, maybe I'm being thick, but this is what I did (see attached) : and it didn't work, also getting errors abt an unprintable character x.x

I'm still learning python and app development, sorry if this is obvious I want Show_About to pull up the libadwaita about window

Screenshot from 2023-07-25 11-47-57 Screenshot from 2023-07-25 11-48-48

Taiko2k commented 1 year ago

Oh right, so the 2nd adw code block is supposed to replace the first. That might not have been clear. So remove everything that starts with self.about.

Btw one being assigned to self.about and the other dialog, the difference doesn't really matter since that object isn't going to be used again, I just should have been more consistent.

As for that invalid character, not sure why that's there, it seems to be a special kind of space, so maybe delete and retype the spaces in lines where you get that error.

MadameMalady commented 1 year ago

I removed everything that started with self.about, and re-did those spaces manually, I now get a different issue abt mismatched indentation:

Screenshot from 2023-07-26 14-32-59 Screenshot from 2023-07-26 14-33-30

Taiko2k commented 1 year ago

It seems like something has gone weird with a copy and paste you did. I'd suggest erasing that whole code block and writing it out manually. You can omit the informational dialog.set_* lines for the purposes of testing.

MadameMalady commented 1 year ago

I re-wrote the lines

    dialog = Adw.AboutWindow(transient_for=app.get_active_window())
    dialog.set_visable(True)

into the definition for Show_About, and I now get:

AttributeError: 'gi.repository.Adw' object has no attribute 'AboutWindow'

Is it possible that some syntax was updated? I think I'll stick with the gdk about window for now, the adwaita one is pretty but I'm struggling a lot to get it working, thanks for trying to help, and for writing these tutorials at all, there's not a lot of resources for ppl trying to learn to make gnome apps yet.