Hi,
Why don’t work the following code for (wxGrid, wxSpinCtrl).
Please help me.
TIA.
#Boa:Frame:frmDesign
from wxPython.wx import *
from wxPython.grid import *
from win32api import SendMessage
import win32ui
import win32gui
WM_PAINT = 0xf
WM_PRINT = 0x317
PRF_CLIENT = 0x4
PRF_CHILDREN = 0x10
PRF_OWNED = 0x20
def create(parent):
return frmDesign(parent)
[wxID_FRMDESIGN, wxID_FRMDESIGNBTN, wxID_FRMDESIGNGRD, wxID_FRMDESIGNPIC,
wxID_FRMDESIGNSP, wxID_FRMDESIGNT12, wxID_FRMDESIGNTXT,
] = map(lambda _init_ctrls: wxNewId(), range(7))
class frmDesign(wxFrame):
def _init_ctrls(self, prnt):
# generated method, don’t edit
wxFrame.init(self, id=wxID_FRMDESIGN, name=u’frmDesign’,
parent=prnt, pos=wxPoint(351, 255), size=wxSize(634, 357),
style=wxDEFAULT_FRAME_STYLE, title=‘wxFrame1’)
self.SetClientSize(wxSize(626, 330))
self.t12 = wxButton(id=wxID_FRMDESIGNT12, label='button1', name=u't12',
parent=self, pos=wxPoint(8, 304), size=wxSize(96, 23), style=0)
EVT_BUTTON(self.t12, wxID_FRMDESIGNT12, self.OnT12Button)
self.pic = wxStaticBitmap(bitmap=wxNullBitmap, id=wxID_FRMDESIGNPIC,
name=u'pic', parent=self, pos=wxPoint(16, 16), size=wxSize(168,
144), style=0)
self.grd = wxGrid(id=wxID_FRMDESIGNGRD, name=u'grd', parent=self,
pos=wxPoint(416, 224), size=wxSize(200, 100), style=0)
self.txt = wxTextCtrl(id=wxID_FRMDESIGNTXT, name=u'txt', parent=self,
pos=wxPoint(440, 120), size=wxSize(160, 21), style=0,
value='textCtrl1')
self.btn = wxButton(id=wxID_FRMDESIGNBTN, label='button1', name=u'btn',
parent=self, pos=wxPoint(440, 48), size=wxSize(75, 23), style=0)
self.sp = wxSpinCtrl(id=wxID_FRMDESIGNSP, initial=0, max=100, min=0,
name=u'sp', parent=self, pos=wxPoint(336, 80), size=wxSize(117,
21), style=wxSP_ARROW_KEYS)
def __init__(self, parent):
self._init_ctrls(parent)
self.grd.CreateGrid(2,10)
def OnT12Button(self, event):
dc = wxClientDC(self.pic)
SendMessage(self.btn.GetHandle(), WM_PAINT, 1, 0)
SendMessage(self.btn.GetHandle(), WM_PRINT, dc.GetHDC(), 2+4+8+16+32)
event.Skip()