Friday, May 3, 2024
 Popular · Latest · Hot · Upcoming
7
rated 0 times [  7] [ 0]  / answers: 1 / hits: 2327  / 1 Year ago, mon, march 27, 2023, 8:17:20

If i create a quickly-project with the following command in terminal:



 quickly create ubuntu-application helloworld


and then add in the HelloworldWindow.py the following lines,



import sys
import pynotify


the line "import pynotify" produces the following error-output on my system when i want to run the application with



quickly run


error-output:




/usr/lib/python2.7/dist-packages/gobject/constants.py:24: Warning: g_boxed_type_register_static: assertion g_type_from_name (name) == 0' failed
import gobject._gobject
/usr/lib/python2.7/dist-packages/gtk-2.0/gtk/__init__.py:40: Warning: specified class size for type
PyGtkGenericCellRenderer' is smaller than the parent type's GtkCellRenderer' class size
from gtk import _gtk
/usr/lib/python2.7/dist-packages/gtk-2.0/gtk/__init__.py:40: Warning: g_type_get_qdata: assertion
node != NULL' failed
from gtk import _gtk




The application won't start.



But if I want to run the following python-application



 #!/usr/bin/python
import sys
import pynotify

if __name__ == "__main__":
if not pynotify.init("icon-summary-body"):
sys.exit(1)

n = pynotify.Notification(
"Notification",
"Hello notify! It works!",
"notification-message-im")
n.show()


e.g. by saving the code in a filename "notify.py", I am able to run the code with the command in terminal:



python notify.py


and the notification works fine!



What is the problem with the via quickly created python applicaton?? Why is the import not working?? I am new with quickly and python.


More From » python

 Answers
0

I just ran into exactly the same problem.



Here's my solution.



from gi.repository import Notify

Notify.init ('Application')
notification = Notify.Notification.new ('Title', 'Message', 'dialog-information')
notification.show ()

[#37269] Wednesday, March 29, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
otatorm

Total Points: 218
Total Questions: 113
Total Answers: 124

Location: British Indian Ocean Territory
Member since Tue, Feb 22, 2022
2 Years ago
otatorm questions
;