Hi,
I have an application with two frames, a parent and a child.
Resource for these frame are taxen from a xrc file.
The main frame has a button to show the child "VampireFrame".
VampireFrame has a button to became semi-transparent.
The problem is that when I start the application, the alphaCycle
method is fired even if I didn't press any button...
What is wrong with this code?
[code]
import wx
from wx import xrc
import random
class MainFrame(wx.Frame):
def __init__(self,parent,resource):
self.PostCreate(resource.LoadFrame(parent,"gigiwxcapture"))
self.panel = xrc.XRCCTRL(self, "config")
self.Bind(wx.EVT_BUTTON, self.OnVampireFrame,
id=xrc.XRCID("selectcapturewindow"))
self.VampireFrame=VampireFrame(self,resource)
def OnVampireFrame(self,evt):
self.VampireFrame.Show()
class VampireFrame(wx.Frame):
def __init__(self,parent,resource):
self.PostCreate(resource.LoadFrame(parent,"vampireFrame"))
self.Centre()
self.SetBackgroundColour(wx.BLUE)
self.Bind(wx.EVT_MOTION, self.ilmousesimuove)
self.windowplaced = xrc.XRCCTRL(self,"windowplaced")
self.windowplaced.Bind(wx.EVT_BUTTON, self.alphaCycle(self,
100))
def ilmousesimuove(self,event):
print "moving"
def alphaCycle(self,dest,amount):
dest.SetTransparent(amount)
print "tras"
class MyApp(wx.App):
def OnInit(self):
resource=xrc.XmlResource("gigiwxGUI.xrc")
self.MainFrame=MainFrame(None,resource)
self.MainFrame.Show()
return True
def main():
app = MyApp(0)
app.MainLoop()
if __name__ == '__main__':
main()
[/code]
Another minor issue: the Centre method puts the child frame in the
centre of the parent frame, I'd like to put it in the centre if the
screen instead: how can I obtain this?