Skip to content

Commit

Permalink
samples: update samples using wxPython (#1965)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelotduarte committed Jul 17, 2023
1 parent 85d66bd commit 2f80b3e
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 13 deletions.
3 changes: 1 addition & 2 deletions samples/matplotlib/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@ pip install --upgrade wxPython
```

There are wheels for ubuntu in:
https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-16.04
https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-18.04
https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-20.04

For example:

```
pip install -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-18.04 wxPython
pip install -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-20.04 wxPython
```
4 changes: 2 additions & 2 deletions samples/matplotlib/matplotlib_eg.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

class CanvasFrame(wx.Frame):
def __init__(self):
super().__init__(None, -1, "CanvasFrame", size=(550, 350))
wx.Frame.__init__(self, None, -1, "CanvasFrame", size=(550, 350))

self.figure = Figure()
self.axes = self.figure.add_subplot()
Expand Down Expand Up @@ -43,9 +43,9 @@ def add_toolbar(self):
class App(wx.App):
def OnInit(self):
"""Create the main window and insert the custom frame."""
self.Init()
frame = CanvasFrame()
frame.Show(True)
self.SetTopWindow(frame)

return True

Expand Down
3 changes: 1 addition & 2 deletions samples/wx/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@ pip install --upgrade wxPython
```

There are wheels for ubuntu in:
https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-16.04
https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-18.04
https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-20.04

For example:

```
pip install -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-18.04 wxPython
pip install -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-20.04 wxPython
```
28 changes: 23 additions & 5 deletions samples/wx/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,33 @@

from cx_Freeze import Executable, setup

base = None
if sys.platform == "win32":
base = "Win32GUI"
base = "Win32GUI" if sys.platform == "win32" else None

executables = [Executable("wxapp.py", base=base)]
options = {
"build_exe": {
# Sometimes a little fine-tuning is needed
# exclude all backends except wx
"excludes": [
"gi",
"gtk",
"PyQt4",
"PyQt5",
"PyQt6",
"PySide2",
"PySide6",
"shiboken2",
"shiboken6",
"tkinter",
]
}
}

executables = [Executable("test_wx.py", base=base)]

setup(
name="hello",
name="wxapp_sample",
version="0.1",
description="Sample cx_Freeze wxPython script",
executables=executables,
options=options,
)
5 changes: 3 additions & 2 deletions samples/wx/wxapp.py → samples/wx/test_wx.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,6 @@ def OnInit(self):
return True


app = App(1)
app.MainLoop()
if __name__ == "__main__":
app = App(1)
app.MainLoop()

0 comments on commit 2f80b3e

Please sign in to comment.