You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Operating system: Windows 10 wxPython version & source: wxPython 4.2.2 from pip, wxPython 4.2.3 from Snapshot builds Python version & source: Python 3.7 (wxPython 4.2.2) Python 3.10 (wxPython 4.2.3)
Description of the problem:
I am opening a rectangle that I had previously saved in a pickle and trying to draw it, however It was saved in python 2.7 and height and width are floats, so are x and y cordinates. However in
the casting of the x and y cordinates is done, but not of height and width, which results in an error when drawing it. Can this be solved with a casting also on height and width? This problem was not present with python 3.7, in fact the simple script that I attach run perfectly in 3.7 but not in 3.10 with wxPython 4.2.3, probably due to a change in the implementation of the DrawRoundedRectangle method.
Code Example (click to expand)
import wx
class RoundedRectangleFrame(wx.Frame):
def __init__(self, *args, **kw):
super(RoundedRectangleFrame, self).__init__(*args, **kw)
# Set up the size and position for the rounded rectangle
self._x1, self._y1 = 400.0, 112.42 # Top-left corner coordinates
self._width, self._height = 80.0, 55.14 # Rectangle width and height
self._cornerRadius = 15 # Corner radius
# Bind the paint event
self.Bind(wx.EVT_PAINT, self.OnPaint)
# Set frame properties
self.SetSize((700, 500))
self.SetTitle("Rounded Rectangle with wxPython")
self.Centre()
def OnPaint(self, event):
# Create a device context for drawing
dc = wx.PaintDC(self)
# Set the background color
dc.SetBackground(wx.Brush("white"))
dc.Clear()
# Set pen and brush for the rectangle
dc.SetPen(wx.Pen("black", width=2))
dc.SetBrush(wx.Brush("sky blue"))
# Draw the rounded rectangle with specified parameters
dc.DrawRoundedRectangle(int(self._x1), int(self._y1), self._width, self._height, self._cornerRadius)
if __name__ == "__main__":
app = wx.App(False)
frame = RoundedRectangleFrame(None)
frame.Show()
app.MainLoop()
The text was updated successfully, but these errors were encountered:
Operating system: Windows 10
wxPython version & source: wxPython 4.2.2 from pip, wxPython 4.2.3 from Snapshot builds
Python version & source: Python 3.7 (wxPython 4.2.2) Python 3.10 (wxPython 4.2.3)
Description of the problem:
I am opening a rectangle that I had previously saved in a pickle and trying to draw it, however It was saved in python 2.7 and height and width are floats, so are x and y cordinates. However in
Phoenix/wx/lib/ogl/basic.py
Line 2772 in 8908dd6
Code Example (click to expand)
The text was updated successfully, but these errors were encountered: