[wxPython] wxDC.Blit

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[wxPython] wxDC.Blit

Sam Pumphrey
Another puzzler,

wxDC.Blit doesn't appear to work in windows:

#-------------------------------------------------

from wxPython.wx import *

class MyFrame(wxFrame):
  def __init__(self,parent,title,id):
    wxFrame.__init__(self,parent,title,id,
                     wxPoint(100,100),wxSize(300,300))

    self.SetBackgroundColour(wxWHITE)
    self.windowx,self.windowy=self.GetClientSizeTuple()

    # make a memory DC to draw into...
    self.mask=wxMemoryDC()

    self.maskbitmap=wxEmptyBitmap(self.windowx,self.windowy
    self.mask.SelectObject(self.maskbitmap)
    self.mask.SetBackgroundMode(wxTRANSPARENT)

    self.mask.SetDeviceOrigin(0,0)

    self.mask.SetBrush(wxBrush(wxColour(150,160,0),wxSOLID))
    self.mask.SetPen(wxPen(wxColour(0,250,230),1,wxSOLID))
    self.mask.DrawRectangle(0,0,self.windowx,self.windowy)


  def OnPaint(self,evt):
    """ overriding OnPaint to give handler. """
    dc = wxPaintDC(self)

    # this works fine in unix but just paints a black square
    # in windows! :(
    dc.Blit(0,0,self.windowx,self.windowy,self.mask,0,0,wxSET)

#-----------------------------------------------------------

if __name__ == "__main__":
  class MyApp(wxApp):
    def OnInit(self):

      self.frame = MyFrame(NULL, -1, "Blit Test")
      self.frame.Show(true)

      self.exiting = FALSE;
      return true

 app = MyApp(0)     # Create an instance of the application
 app.MainLoop()     # Tell it to start processing events


###############################

This works perfectly using gtk, but not with windows.
I'm running it with:
SunOS 5.5.1
Windows NT 4 (SP5)


TIA,

Sam

------------------------------------------------------
   Sam Pumphrey - Project SPIRIT, AT&T Research UK
 Email: [hidden email] - Tel: (01223) 343215
------------------------------------------------------



_______________________________________________
wxPython-users maillist  -  [hidden email]
http://starship.python.net/mailman/listinfo/wxpython-users




Reply | Threaded
Open this post in threaded view
|

Re: [wxPython] wxDC.Blit

Kevin Jacobs
On Mon, 9 Aug 1999, Sam Pumphrey wrote:
> Another puzzler,
> wxDC.Blit doesn't appear to work in windows:

We found something like this when porting PIDDLE to wxPython.  It may be
fixable, but its hard to say given your mailer truncated long lines.
Specifically:

>     self.maskbitmap=wxEmptyBitmap(self.windowx,self.windowy

If you do not specify a depth parameter, our code that uses blits works on
both MSW and GTK.

-Kevin
>

--
----------->  Kevin Jacobs  <-----------|------->  (216) 778-8487  <--------
S.A.G.E. Project Technical Coordinator  | Department of Epidemiology
  & System Administrator                |   & Biostatistics    
Internet E-mail: [hidden email] | Case Western Reserve University
----------------------------------------------------------------------------


_______________________________________________
wxPython-users maillist  -  [hidden email]
http://starship.python.net/mailman/listinfo/wxpython-users




Reply | Threaded
Open this post in threaded view
|

Re: [wxPython] wxDC.Blit

Sam Pumphrey
> We found something like this when porting PIDDLE to wxPython.  It may be
> fixable, but its hard to say given your mailer truncated long lines.
> Specifically:
>
> >  self.maskbitmap=wxEmptyBitmap(self.windowx,self.windowy

Sorry, I missed off the last bracket. I do not specify a depth parameter.





_______________________________________________
wxPython-users maillist  -  [hidden email]
http://starship.python.net/mailman/listinfo/wxpython-users




Reply | Threaded
Open this post in threaded view
|

Re: [wxPython] wxDC.Blit

Robin Dunn
In reply to this post by Sam Pumphrey
> Another puzzler,
>
> wxDC.Blit doesn't appear to work in windows:
>
>   def OnPaint(self,evt):
>     """ overriding OnPaint to give handler. """
>     dc = wxPaintDC(self)
>
>     # this works fine in unix but just paints a black square
>     # in windows! :(
>     dc.Blit(0,0,self.windowx,self.windowy,self.mask,0,0,wxSET)
>
> #-----------------------------------------------------------

If you use wxCOPY instead of wxSET it works on MSW.

--
Robin Dunn
Software Craftsman
[hidden email]
http://AllDunn.com/robin/
http://AllDunn.com/wxPython/  Check it out!



_______________________________________________
wxPython-users maillist  -  [hidden email]
http://starship.python.net/mailman/listinfo/wxpython-users