From c83c415403dab2a87becdb6f70426c62d0fd9225 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 21 May 2021 01:39:59 -0400 Subject: [PATCH 1/4] Hide Axis in pong example. --- examples/event_handling/pipong.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/event_handling/pipong.py b/examples/event_handling/pipong.py index 7d0acab617fa..a03beead70a2 100644 --- a/examples/event_handling/pipong.py +++ b/examples/event_handling/pipong.py @@ -124,8 +124,10 @@ class Game: def __init__(self, ax): # create the initial line self.ax = ax - ax.set_ylim([-1, 1]) + ax.xaxis.set_visible(False) ax.set_xlim([0, 7]) + ax.yaxis.set_visible(False) + ax.set_ylim([-1, 1]) pad_a_x = 0 pad_b_x = .50 pad_a_y = pad_b_y = .30 @@ -168,7 +170,6 @@ def __init__(self, ax): self.res = 100.0 self.on = False self.inst = True # show instructions from the beginning - self.background = None self.pads = [Pad(pA, pad_a_x, pad_a_y), Pad(pB, pad_b_x, pad_b_y, 'r')] self.pucks = [] From 15c774e0dbefa574634f2b3da1b5932be9762bbd Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 21 May 2021 01:40:15 -0400 Subject: [PATCH 2/4] Fix textcoords warning in Pong example. --- examples/event_handling/pipong.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/event_handling/pipong.py b/examples/event_handling/pipong.py index a03beead70a2..b3064d0c84ee 100644 --- a/examples/event_handling/pipong.py +++ b/examples/event_handling/pipong.py @@ -178,7 +178,7 @@ def __init__(self, ax): verticalalignment='center', horizontalalignment='center', multialignment='left', - textcoords='axes fraction', + xycoords='axes fraction', animated=False) self.canvas.mpl_connect('key_press_event', self.on_key_press) From 7798242036ce3067c6059322b22dc7fbe6590506 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 21 May 2021 03:02:26 -0400 Subject: [PATCH 3/4] Fix SVG histogram example. `Element.getchildren` was removed in Python 3.9, but more importantly, blindly picking the first subelement is completely broken since we added metadata to SVG. Using XPath finds the `style` tag wherever it might be. --- examples/user_interfaces/svg_histogram_sgskip.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/user_interfaces/svg_histogram_sgskip.py b/examples/user_interfaces/svg_histogram_sgskip.py index 026cb5b1cc03..4311399fcae6 100644 --- a/examples/user_interfaces/svg_histogram_sgskip.py +++ b/examples/user_interfaces/svg_histogram_sgskip.py @@ -149,7 +149,7 @@ """ % json.dumps(hist_patches) # Add a transition effect -css = tree.getchildren()[0][0] +css = tree.find('.//{http://www.w3.org/2000/svg}style') css.text = css.text + "g {-webkit-transition:opacity 0.4s ease-out;" + \ "-moz-transition:opacity 0.4s ease-out;}" From 0e45e4373fd8705c4086b8bd1f8b519b2739b352 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 21 May 2021 03:18:40 -0400 Subject: [PATCH 4/4] Fix float-to-int cast warnings in wx Fourier demo. --- examples/user_interfaces/fourier_demo_wx_sgskip.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/user_interfaces/fourier_demo_wx_sgskip.py b/examples/user_interfaces/fourier_demo_wx_sgskip.py index ba67e925dcd8..86441ed0c838 100644 --- a/examples/user_interfaces/fourier_demo_wx_sgskip.py +++ b/examples/user_interfaces/fourier_demo_wx_sgskip.py @@ -70,7 +70,7 @@ def __init__(self, parent, label, param): self.sliderText = wx.TextCtrl(parent, -1, style=wx.TE_PROCESS_ENTER) self.slider = wx.Slider(parent, -1) # self.slider.SetMax(param.maximum*1000) - self.slider.SetRange(0, param.maximum * 1000) + self.slider.SetRange(0, int(param.maximum * 1000)) self.setKnob(param.value) sizer = wx.BoxSizer(wx.HORIZONTAL) @@ -99,7 +99,7 @@ def sliderTextHandler(self, event): def setKnob(self, value): self.sliderText.SetValue('%g' % value) - self.slider.SetValue(value * 1000) + self.slider.SetValue(int(value * 1000)) class FourierDemoFrame(wx.Frame):