GTK4PythonTutorial icon indicating copy to clipboard operation
GTK4PythonTutorial copied to clipboard

Please add a Gtk.MessageDialog

Open misterhsp opened this issue 3 years ago • 8 comments

Please add a Gtk.MessageDialog to e.g. display an error or a hint. And close button.

Thanks ...

misterhsp avatar Nov 05 '22 07:11 misterhsp

I tried this, but the dialog does not appear. No error message.

    def error(self, error_msg):
        self.dialog = Gtk.MessageDialog(
             buttons = Gtk.ButtonsType.OK,
             modal = True,
             title = ("Error"),
             text = (error_msg),
             transient_for = self)
        self.dialog.connect('response', lambda d,i: d.destroy())
        self.dialog.show()

There seems to be something missing I think...

...

misterhsp avatar Nov 11 '22 17:11 misterhsp

In a quick test that code above does seem to work for me

Taiko2k avatar Nov 12 '22 06:11 Taiko2k

Not for me, no dialog box appears. I have no idea why.

Am 12.11.22 um 07:58 schrieb Taiko2k:

In a quick test that code above does seem to work for me

— Reply to this email directly, view it on GitHub https://github.com/Taiko2k/GTK4PythonTutorial/issues/10#issuecomment-1312392397, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKGJLRML5VWEE7MIUIEGLRLWH45YPANCNFSM6AAAAAARXZ3ITM. You are receiving this because you authored the thread.Message ID: @.***>

misterhsp avatar Nov 12 '22 07:11 misterhsp

Small addendum: I took everything according to your code base. Only the dialog I have searched together.

Am 12.11.22 um 07:58 schrieb Taiko2k:

In a quick test that code above does seem to work for me

— Reply to this email directly, view it on GitHub https://github.com/Taiko2k/GTK4PythonTutorial/issues/10#issuecomment-1312392397, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKGJLRML5VWEE7MIUIEGLRLWH45YPANCNFSM6AAAAAARXZ3ITM. You are receiving this because you authored the thread.Message ID: @.***>

misterhsp avatar Nov 12 '22 07:11 misterhsp

Just to double check, you did call the error() function at some point?

Taiko2k avatar Nov 12 '22 13:11 Taiko2k

Yes, of course.

I will try again tonight after work.

Am 12.11.22 um 14:40 schrieb Taiko2k:

Just to double check, you did call the |error()| function at some point?

— Reply to this email directly, view it on GitHub https://github.com/Taiko2k/GTK4PythonTutorial/issues/10#issuecomment-1312480628, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKGJLRK2BIF6WEQONCG2SKTWH6M6DANCNFSM6AAAAAARXZ3ITM. You are receiving this because you authored the thread.Message ID: @.***>

misterhsp avatar Nov 12 '22 14:11 misterhsp

I don't even want to say it, it's my own fault. I had a self.close() in the script where it didn't belong. Now the dialog works.

Sorry for the inconvenience :-)

misterhsp avatar Nov 12 '22 17:11 misterhsp

Do you maybe already have an example gtk4 grid?

thanks

misterhsp avatar Nov 19 '22 19:11 misterhsp