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.

Save position of a wx.MiniFrame

If you have a question or need help, this is the place to be.
Post Reply
thug
Plugin Developer
Posts: 64
Joined: Sat Jul 22, 2006 2:37 pm
Location: Australia

Save position of a wx.MiniFrame

Post by thug »

Just me again...

I have a plugin that creates a wx.MiniFrame of a particular size (not important)

How can I store the position (x0,y0) of that miniframe and then retrieve the position when EG runs again?

Or I suppose... how can I store "a bunch of information" so that the I can retrieve it again when EG starts? :?
User avatar
Bitmonster
Site Admin
Posts: 2239
Joined: Mon Feb 06, 2006 10:28 pm

Post by Bitmonster »

I should implement a real property for this but currently you can make it this way:

1. Create a class with default values somewhere:

Code: Select all

class Defaults:
    x = 0
    y = 0
2. In your plugin __init__ do this call (Defaults is the class you created in 1.):

Code: Select all

self.config = eg.GetConfig("plugins." + self.info.evalName, Defaults)
3. Now you can access and store new values to this self.config object:

Code: Select all

window.SetPosition((self.config.x, self.config.y))
...
self.config.x, self.config.y = window.GetPosition()
EG will save these values on exit and retrieve them on the next start. On the first use it will fill up the object with the default values. You can use all basic types as attributes like int, float, string, boolean and lists/tuples out of them.
Post Reply