Operating system: macOS High Sierra (Version 10.3.5)
wxPython version: wxPython-4.0.1.dist
Stock or custom build: Stock
Python version: Python 3.6
Stock or custom build: Stock
Description of the problem:
When creating wx.Brush() with style BRUSHSTYLE_VERTICAL_HATCH, or other hatch style alike, to draw ractangle, and together drawing with other rectangle with different border thickness, the
hatch line thinkness is not correctly reflected. (Pls. run and see sample code demonstrated.)
# Put code sample here
import wx
class BasePanel(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent)
self.rcs = [ wx.Rect(100, 50, 150, 100), wx.Rect(300, 50, 150, 100)]
self.is_new_pos = None
self.mouse_pos = None
self.mouse_last_pos = None
self.inside = None
self.Bind(wx.EVT_MOTION, self.OnMotion)
self.Bind(wx.EVT_PAINT, self.OnPaint)
def OnMotion(self, event):
new_pos = event.GetPosition()
self.is_new_pos = False
if new_pos != self.mouse_last_pos:
self.mouse_last_pos = self.mouse_pos
self.mouse_pos = new_pos
self.is_new_pos = True
self.inside = -1
for m in range(len(self.rcs)):
rc = self.rcs[m]
if self.check_in_rc(rc):
self.inside = m
self.Refresh()
def check_in_rc(self, rc):
if not self.mouse_pos:
return False
if self.mouse_pos.x > rc.left and self.mouse_pos.x < rc.left + rc.width \
and self.mouse_pos.y > rc.top and self.mouse_pos.y < rc.top + rc.height:
return True
return False
def OnPaint(self, event):
dc = wx.PaintDC(self)
dc.Clear()
for m in range(len(self.rcs)):
rc = self.rcs[m]
if m == self.inside:
dc.SetPen(wx.Pen('red', 5))
dc.SetBrush(wx.Brush('yellow', wx.BRUSHSTYLE_SOLID))
dc.DrawRectangle(rc)
else:
dc.SetPen(wx.Pen('green', 1))
dc.SetBrush(wx.Brush('blue', wx.BRUSHSTYLE_VERTICAL_HATCH))
dc.DrawRectangle(rc)
if __name__ == '__main__':
app = wx.App()
frame_sz = (600, 250)
frame = wx.Frame(None, wx.ID_ANY, size=frame_sz, title='Debug brush hatch')
frame.SetMinSize(frame_sz)
frame.SetMaxSize(frame_sz)
panel = BasePanel(frame)
frame.Raise()
frame.Show()
app.MainLoop()
Operating system: macOS High Sierra (Version 10.3.5) wxPython version: wxPython-4.0.1.dist Stock or custom build: Stock Python version: Python 3.6 Stock or custom build: Stock
Description of the problem:
When creating wx.Brush() with style BRUSHSTYLE_VERTICAL_HATCH, or other hatch style alike, to draw ractangle, and together drawing with other rectangle with different border thickness, the hatch line thinkness is not correctly reflected. (Pls. run and see sample code demonstrated.)