资源简介
同学大一时候的作业,感觉很不错就是算起来有点慢
代码片段和文件信息
# graphics.py
“““Simple object oriented graphics library
The library is designed to make it very easy for novice programmers to
experiment with computer graphics in an object oriented fashion. It is
written by John Zelle for use with the book “Python Programming: An
Introduction to Computer Science“ (Franklin Beedle & Associates).
LICENSE: This is open-source software released under the terms of the
GPL (http://www.gnu.org/licenses/gpl.html).
PLATFORMS: The package is a wrapper around Tkinter and should run on
any platform where Tkinter is available.
INSTALLATION: Put this file somewhere where Python can see it.
OVERVIEW: There are two kinds of objects in the library. The GraphWin
class implements a window where drawing can be done and various
Graphicsobjects are provided that can be drawn into a GraphWin. As a
simple example here is a complete program to draw a circle of radius
10 centered in a 100x100 window:
--------------------------------------------------------------------
from graphics import *
def main():
win = GraphWin(“My Circle“ 100 100)
c = Circle(Point(5050) 10)
c.draw(win)
win.getMouse() # Pause to view result
win.close() # Close window when done
main()
--------------------------------------------------------------------
GraphWin objects support coordinate transformation through the
setCoords method and pointer-based input through getMouse.
The library provides the following graphical objects:
Point
Line
Circle
Oval
Rectangle
Polygon
Text
Entry (for text-based input)
Image
Various attributes of graphical objects can be set such as
outline-color fill-color and line-width. Graphical objects also
support moving and hiding for animation effects.
The library also provides a very simple class for pixel-based image
manipulation Pixmap. A pixmap can be loaded from a file and displayed
using an Image object. Both getPixel and setPixel methods are provided
for manipulating the image.
DOCUMENTATION: For complete documentation see Chapter 4 of “Python
Programming: An Introduction to Computer Science“ by John Zelle
published by Franklin Beedle & Associates. Also see
http://mcsp.wartburg.edu/zelle/python for a quick reference“““
# Version 4.1 12/29/2009
# * Merged Pixmap and Image class. Old Pixmap removed use Image.
# Version 4.0.1 10/08/2009
# * Modified the autoflush on GraphWin to default to True
# * Autoflush check on close setBackground
# * Fixed getMouse to flush pending clicks at entry
# Version 4.0 08/2009
# * Reverted to non-threaded version. The advantages (robustness
# efficiency ability to use with other Tk code etc.) outweigh
# the disadvantage that interactive use with IDLE is slightly more
# cumbersome.
# * Modified to run in either Python 2.x or 3.x (same file).
# * Added Image.getPixmap()
# * Added update() -- stand alone function to cause any pending
# graphics changes to d
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 27685 2010-11-12 17:11 1\graphics.py
文件 35394 2011-05-17 12:38 1\graphics.pyc
文件 10583 2011-05-22 21:03 1\Othello.py
文件 13083 2010-12-18 15:04 1\Othello.pyc
文件 43520 2010-12-27 12:32 1\文档.doc
目录 0 2011-06-09 15:01 1
----------- --------- ---------- ----- ----
130265 6
- 上一篇:Python 获取USB摄像头图像,并二值化
- 下一篇:树莓派小车物体追踪
相关资源
- Python 获取USB摄像头图像,并二值化
- Python WxPython开源扫雷游戏PyMine新版1
- 人脸检测+保存图片
- pycrypto-2.6.1-cp36-cp36m-win_amd64.whl
- 用python实现一个百度百科的爬虫工具
- Python 的PIL库,包含freetype
- alpha_shape.zip
- python人脸追踪
- 鱼c小甲鱼零基础学python全套视频和课
- PyQwt-5.2.1-cp37-cp37m-win_amd64.whl
- 房价预测的BP神经网络实现_python代码
- Python3.x+Pyqt5实现主窗体与子窗体相互
- Python实现动物识别产生式系统
- py2exe for 2.764位
- testbrowse.py
- python实现的k-means算法
- 问卷星爬虫带验证码
- python LDA学习
- 随机森林的代码实现和相应的数据集
-
Python sc
ripts For ABAQUS: Learn By Example - 小甲鱼零基础入门学习Python视频教程
- 基于tensorflow的二分类的python实现注释
- 《PyTorch生成对抗网络编程》思维导图
- 基于Python实现LFM种子传播算法
- 密码学重合指数计算python实现
- python新手算法函数思想入门项目,包
- 已知空间坐标和对应的属性,利用p
- 小甲鱼pythons视频+课件+源代码(96天)
- 找出最长的句子最长的单词
- 如何封装一个带传参的python程序成可
评论
共有 条评论