CISC101 Reminders Last lecture! Grading of Quiz 4 underway. Winter 2018 CISC101 9/17/2018 CISC101 Reminders Last lecture! Grading of Quiz 4 underway. Last assignment due tomorrow. We have covered everything you need to know for the assignment. Winter 2018 CISC101 - Prof. McLeod Prof. Alan McLeod
Today GUI Construction With tkinter, Cont.: Radiobutton and Canvas Widgets. Bears Demo. More Python tools and modules. Winter 2018 CISC101 - Prof. McLeod
Radiobutton Widget See Window14.py Each Radiobutton is bound to the same variable as well as triggering the same function. You can only choose one Radiobutton at a time. Winter 2018 CISC101 - Prof. McLeod
The Canvas Widget You can use this widget to display any drawn shapes, or images, or even a turtle drawing. The canvas can be interactive, allowing the cursor to draw or edit an image. See: Window15.py (drawn shapes) Window15A.py (an image) Window16.py (cursor drawing) Window17.py (turtle drawing!) Winter 2018 CISC101 - Prof. McLeod
An Advanced Demo: BearsDBV2.py Allows viewing and editing of the bears database, one record at a time. (Based on Exercise 9.) Entry Widgets, Buttons, Labels, a Frame, and a LabelFrame. Control Variables. Binding of control variables and handlers (functions). No more globals! Handler functions have been declared inside main! Button navigation. Store and display images in a Canvas widget. Use of a filedialog to obtain an image file. Use of an errordialog to provide a file not found message. Winter 2018 CISC101 - Prof. McLeod
Building a Game? Pygame is not a bad place to start. You can build decent looking arcade-style games fairly easily. (Python might not be the best choice of a platform for more complex or demanding games…) See https://www.pygame.org/wiki/GettingStarted Pygame was lagging behind Python versions, but developers have recently caught up. Winter 2018 CISC101 - Prof. McLeod
Other GUI Tools Lots! IDE and different Widget sets. See WxWidgets, for example. Start by looking at: https://wiki.python.org/moin/GuiProgramming WxPython: http://www.wxpython.org/ Or see gui2py: https://code.google.com/p/gui2py/ Winter 2018 CISC101 - Prof. McLeod
Other IDEs IDLE is pretty simple and a good place to start learning Python. But, it can be frustrating after a while if you are used to more sophisticated IDEs: Poor intellisense and code completion. No debugger. No line numbering! No code wizards, project browsers, etc. “Multi-Lingual” IDEs like Visual Studio (uses “PTVS”), Eclipse (uses PyDev) and Qt can be configured to help write Python programs. Winter 2018 CISC101 - Prof. McLeod
Other IDEs, Cont. PyCharm: http://www.jetbrains.com/pycharm/ Works on Windows, Mac and Linux. Winter 2018 CISC101 - Prof. McLeod
https://pypi.python.org/pypi Other Modules Lots! See the Python Package Index at: https://pypi.python.org/pypi Or, try out the Beta version of a jazzed-up index: https://pypi.org/ Winter 2018 CISC101 - Prof. McLeod
For Example: Enthought Canopy A collection of many packages from many sources – targeted towards data analysis, modeling and visualization. https://enthought.com/products/canopy/ Like Matlab, but based on Python and all code is open, not proprietary. Now available for Python version 3.5. Free for academic use! Winter 2018 CISC101 - Prof. McLeod
Anaconda https://www.anaconda.com/download/ Comes with 1000+ scientific packages included. Free for academic use. Available for Python 3.6. Both Canopy and Anaconda will work with Windows, Mac and Linux. Winter 2018 CISC101 - Prof. McLeod
Scientific Python IDE Pyzo. See: http://www.pyzo.org/ Noted for its web-based, simple interface. Uses the Qt IDE for GUI development. Winter 2018 CISC101 - Prof. McLeod
Python vs Matlab See: http://www.pyzo.org/python_vs_matlab.html And: http://kitchingroup.cheme.cmu.edu/blog/2013/12/30/Python-as-alternative-to-Matlab-for-engineering-calculations/ Winter 2018 CISC101 - Prof. McLeod
http://xkcd.com/353/ From: Winter 2018 CISC101 - Prof. McLeod