Hi there,
I am very new to python and wx and all that and I have a problem with my program, I'm trying to save what's been drawn on the screen,but just cant make it work. Here is the code:
import wx
class MPanel(wx.Window):
def __init__(self, parent):
wx.Window.__init__(self, parent)
self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM)
self.SetClientSizeWH(500,500)
self.SetBackgroundColour("WHITE")
#...
self.Bind(wx.EVT_PAINT, self.on_paint)
self.Bind(wx.EVT_CHAR, self.on_character)
#some functions here...
def on_paint(self,event):
dc = wx.AutoBufferedPaintDC(self)
dc.Clear()
#dc.draw some stuff
def on_character(self,event):
if key==115: #s
#img = ........?
#img.SaveFile("image1.jpg", wx.BITMAP_TYPE_JPEG)
class MFrame(wx.Frame):
def __init__(self, parent, id):
wx.Frame.__init__(self, parent, id,"titleee")
self.panel = MPanel(self)
app = wx.App(False)
frame = MFrame(parent=None, id)
frame.Show(True)
app.MainLoop()
So how should I define img or is there another way to make it work? :-/