Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6358113
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:18:20+00:00 2026-05-24T23:18:20+00:00

I just started with python and wrote myself a nice, small script that uses

  • 0

I just started with python and wrote myself a nice, small script that uses
gnome-notifications via pynotify, like this:

import pynotify

pynotify.init("Application") 
alert = pynotify.Notification("Title", "Description") 
alert.show();

This works great, but the thing is, when I execute the script twice in a row it takes a while for the first notification to go away. The second gets shown after that. Since the first one is obsolete when i execute the script for the second time, I want to remove the first one programmatically prior to showing the second (or replace it). Is this possible, and if it is, how?

A bit of context to understand why I need this: Since I often switch my mouse from left- to right-handed and the other way around, I want a script that just inverts this preference and tells me in a notification “switched to left-handed” and “switched to right-handed”.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T23:18:21+00:00Added an answer on May 24, 2026 at 11:18 pm

    I searched around for a while and came to the conclusion that it is not possible in this case.

    You are able to use Notification.update() to update an existing notification object. But you can’t query existing ones from the system to modify or hide them. It may be possible to store the object somewhere via serialization and restore it to update. But even then you still have to know the exact duration of the notification and the timestamp when you launched it, since there is no way to test if a notification is still visible.

    A short sample how to use update(). Just for reference, since the pynotify doc seems almost non-existent to me:

    #!/usr/bin/env python
    
    import pynotify
    
    pynotify.init("MyApplication")
    
    a = pynotify.Notification("Test notification", "Lorem ipsum op")
    a.show()
    raw_input("Press return to update the notification")
    a.update("Updated notification", "Ipsum lorem still op")
    a.show()
    

    You have to call show() after the update. Otherwise the changes won’t get displayed.

    There is also a close() function in the Notification object, but that doesn’t do anything for me (on Linux/Gnome, may be system dependend).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just started with Python, Is there some iteration in dictionary like in PHP
I have just started with Python. When I execute a python script file on
I just started with Python 3. In a Python book i read that the
So ive just started learning python on WAMP, ive got the results of a
Just started getting a bunch of errors on our C# .Net app that seemed
So I'm really new to programming, I just started learning Python yesterday and I'm
I'm just getting started with twisted.web, and I'm having trouble importing a Python module
I just started Python programming, and I'm wondering about the elif keyword. Other programming
I have just started python and came across something kind of strange. The following
I've just started using Python and I was thinking about which notation I should

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.