Permalink
Browse files

Make compatible with wxPython 3.0

1 parent 5c97e9f commit 0d691334dfd15a107d855df664ed5d0ce5af32f2 @bittner bittner committed Dec 17, 2016
Showing with 12 additions and 4 deletions.
  1. +12 −4 src/pythonturtle.py
View
@@ -154,7 +154,11 @@ def give_focus_to_selected_page(event=None):
for [caption, bitmap_file] in self.help_images_list]
for page in self.help_pages:
- self.help_notebook.AddPage(page, caption=page.caption)
+ try:
+ # avoid TypeError: Required argument 'text' in wxPython > 2.9
+ self.help_notebook.AddPage(page, text=page.caption)
+ except TypeError:
+ self.help_notebook.AddPage(page, caption=page.caption)
self.help_close_button_panel = wx.Panel(parent=self.help_screen)
self.help_screen_sizer = wx.BoxSizer(wx.VERTICAL)
@@ -206,7 +210,7 @@ def init_about_dialog_info(self):
An educational environment for learning Python, suitable for beginners and children.
Inspired by LOGO.
-Runs on Python 2.6, using wxPython, Psyco and py2exe. Thanks go to the developers
+Runs on Python 2.6/2.7, using wxPython, Psyco and py2exe. Thanks go to the developers
responsible for these projects, as well as to the helpful folks at the user groups
of these projects, and at StackOverflow.com, who have helped solved many problems
that came up in the making of this program."""
@@ -236,8 +240,12 @@ def __init__(self, parent, bitmap, caption):
def run():
multiprocessing.freeze_support()
- app = wx.PySimpleApp()
- my_app_win = ApplicationWindow(None,-1,"PythonTurtle",size=(600,600))
+ try:
+ # anticipate deprecation (wxPyDeprecationWarning in wxPython >= 2.9)
+ app = wx.PySimpleApp()
+ except AttributeError:
+ app = wx.App()
+ ApplicationWindow(None, -1, "PythonTurtle", size=(600, 600))
#import cProfile; cProfile.run("app.MainLoop()")
app.MainLoop()

0 comments on commit 0d69133

Please sign in to comment.