Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details

If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.

python script and OSD

If you have a question or need help, this is the place to be.
Post Reply
richy759
Posts: 7
Joined: Sat May 09, 2009 2:03 pm

python script and OSD

Post by richy759 »

Is it possible to show a variable on screen through the OSD via a python script. I can't seem to find any reference to this in the forum.
I want to show a variable like this
eg.plugins.ShowOSD(eg.globals.my_var)

Is there a list somewhere of what functions can be called from eg?
Please go easy on me, I only just found EventGhost today and am loving it already :)
Thanks in advance

Rich

p.s. I'm using 0.3.7.r965
stottle
Plugin Developer
Posts: 636
Joined: Sun Apr 26, 2009 10:59 pm

Re: python script and OSD

Post by stottle »

Here's a tip I've found pretty helpful.

Under the EG help menu there is the python shell option. If you click this, it brings up a command line python shell, with the eg object already imported - but with autocompletion. So if you type "eg.", the list of available members/functions of eg will be listed.

From this, I was able to find ShowOSD as part of a dictionary under eg.plugins.EventGhost.actions. I tested the following and it seems to work:

Code: Select all

show = eg.plugins.EventGhost.actions["ShowOSD"]() #this creates a ShowOSD action object
show("This is a test")


Good luck,
Brett
User avatar
Bitmonster
Site Admin
Posts: 2239
Joined: Mon Feb 06, 2006 10:28 pm

Re: python script and OSD

Post by Bitmonster »

Please post software-related questions in the forum - PMs will only be answered, if really private, thanks!
User avatar
topix
Experienced User
Posts: 441
Joined: Sat May 05, 2007 3:43 pm
Location: Germany
Contact:

Re: python script and OSD

Post by topix »

richy759 wrote:Is it possible to show a variable on screen through the OSD via a python script. I can't seem to find any reference to this in the forum.
I want to show a variable like this
eg.plugins.ShowOSD(eg.globals.my_var)

Code: Select all

<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="918">
    <Action>
        EventGhost.PythonScript(u'eg.globals.my_variable = "Something to show"\neg.plugins.EventGhost.ShowOSD(u\'{eg.globals.my_variable}\', u\'0;-24;0;0;0;700;0;0;0;1;0;0;2;32;Arial\', (255, 255, 255), (0, 0, 0), 0, (111, 111), 0, 3.0, True)\n')
    </Action>
</EventGhost>
richy759
Posts: 7
Joined: Sat May 09, 2009 2:03 pm

Re: python script and OSD

Post by richy759 »

thanks guys, the python shell under help is exactly what I want to show me whats available.
Bitmonster, I did look at that page, which is a nice summary, but didn't really help me in my case. Perhaps it could mention the python shell under help.
topix, I have taken your example and it works nicely. Are the arguments to ShowOSD documented?

I have to say, I am loving EG.

Cheers,
Rich
Post Reply