checking running status

Hi there,

So I've recently wanted to add the following feature to my programs:

1. When you minimise the program, it hides the window completely.

2. When you try to reopen the program, it checks to see if the program is already running, and if it is, it just shows that window again then exits the second program.

Is this possible?

Thanks

Nathan

Hi there,

So I’ve recently wanted to add the following feature to my programs:

  1. When you minimise the program, it hides the window completely.

Catch the frame’s EVT_ICONIZE event and call Hide there if evt.IsIconized() is True

  1. When you try to reopen the program, it checks to see if the program
    is already running, and if it is, it just shows that window again then
    exits the second program.

You can use wx.SingleInstanceChecker to see if there is already an instance of the application running. It doesn’t support doing anything with that other instance however, so you’ll need to come up with your own way to communicate with that instance and tell it to show itself again.

···

On Thursday, February 28, 2019 at 6:43:31 AM UTC-8, Nathan Smith wrote:

Robin

Hi there,

Thanks for that. I was aware of the instance checker.

Would it be horribly hackish just to have it do something like:

In the hidden window:

have a timer that runs every 5 seconds.

  In timer, it opens appdata/roming/program name/randomfile.txt and

if value is 1, it shows itself?

Is that a bad idea?

thanks

···

On 01/03/2019 00:26, Robin Dunn wrote:

    On Thursday, February 28, 2019 at 6:43:31 AM UTC-8,

Nathan Smith wrote:

      Hi

there,

      So I've recently wanted to add the following feature to my

programs:

      1. When you minimise the program, it hides the window

completely.

      Catch the frame's EVT_ICONIZE event and call Hide there if

evt.IsIconized() is True

      2. When

you try to reopen the program, it checks to see if the program

      is already running, and if it is, it just shows that window

again then

      exits the second program.
      You can use wx.SingleInstanceChecker to see if there is

already an instance of the application running. It doesn’t
support doing anything with that other instance however, so
you’ll need to come up with your own way to communicate with
that instance and tell it to show itself again.

Robin

  You received this message because you are subscribed to the Google

Groups “wxPython-users” group.

  To unsubscribe from this group and stop receiving emails from it,

send an email to wxpython-users+unsubscribe@googlegroups.com.

  For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

I’m not sure of I would
use your way. I would be looking for code that works at the OS
level.

    I would use the wx.SingleInstanceChecker to confirm the presents

of the first instance and then run code to open the minimized
window (most likely via the OS and platform depended and it
assumes it is minimized) - then close the second instance. I
would check the actual code (the c code) and determine how they
are finding the first instance - it might help you find the code
to open the first instance.

    Johnf
···

On 2/28/19 6:03 PM, Nathan smith wrote:

Hi there,

Thanks for that. I was aware of the instance checker.

Would it be horribly hackish just to have it do something like:

In the hidden window:

have a timer that runs every 5 seconds.

    In timer, it opens appdata/roming/program name/randomfile.txt

and if value is 1, it shows itself?

Is that a bad idea?

thanks

  -- You received this message because you are subscribed to the Google

Groups “wxPython-users” group.
To unsubscribe from this group and stop receiving emails from it,
send an email to .
For more options, visit .

    On 01/03/2019 00:26, Robin Dunn

wrote:

      On Thursday, February 28, 2019 at 6:43:31 AM

UTC-8, Nathan Smith wrote:

        Hi

there,

        So I've recently wanted to add the following feature to my

programs:

        1. When you minimise the program, it hides the window

completely.

        Catch the frame's EVT_ICONIZE event and call Hide there

if evt.IsIconized() is True

        2.

When you try to reopen the program, it checks to see if the
program

        is already running, and if it is, it just shows that window

again then

        exits the second program.
        You can use wx.SingleInstanceChecker to see if there is

already an instance of the application running. It doesn’t
support doing anything with that other instance however, so
you’ll need to come up with your own way to communicate with
that instance and tell it to show itself again.

Robin

    You received this message because you are subscribed to the

Google Groups “wxPython-users” group.

    To unsubscribe from this group and stop receiving emails from

it, send an email to wxpython-users+unsubscribe@googlegroups.com.

    For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

wxpython-users+unsubscribe@googlegroups.com
https://groups.google.com/d/optout