中国高校课件下载中心 》 教学资源 》 大学文库

上海交通大学:《Computational Thinking and Approach》教学资源(课件讲稿)Lecture06 OBJECTS AND GRAPHICS GUI

文档信息
资源类别:文库
文档格式:PDF
文档页数:27
文件大小:504.35KB
团购合买:点击进入团购
内容简介
• The Object of Objects • Simple graphics programming • Using Graphical Objects • Interactive Graphics • Displaying Images • Playing music
刷新页面文档预览

上游充通大 ParisTech SHANGHAI JIAO TONG UNIVERSITY INSTITUT DES SCIENCES ET TECHNOLOGIES PARIS INSTITUTE OF TECHNOLOGY Computational Thinking and Approach Lecture 6 Dr.Jialiang LU Jialiang.lu@situ.edu.cn

Computational Thinking and Approach Lecture 6 Dr. Jialiang LU Jialiang.lu@sjtu.edu.cn

上游充通大 ParisTech SHANGHAI JIAO TONG UNIVERSITY INSTITUT DES SCIENCES ET TECHNOLOGIES PARIS INSTITUTE OF TECHNOLOGY GUI OBJECTS AND GRAPHICS

OBJECTS AND GRAPHICS GUI

上游充通大 ParisTech SHANGHAI JIAO TONG UNIVERSITY INSTITUT DES SCIENCES ET TECHNOLOGIES PARIS INSTITUTE OF TECHNOLOGY Outlines ·The Object of Objects 。 Simple graphics programming Using Graphical Objects Interactive Graphics ·Displaying Images ·Playing music

Outlines • The Object of Objects • Simple graphics programming • Using Graphical Objects • Interactive Graphics • Displaying Images • Playing music

上游充通大 ParisTech SHANGHAI JIAO TONG UNIVERSITY INSTITUT DES SCIENCES ET TECHNOLOGIES PARIS INSTITUTE OF TECHNOLOGY The Object of Objects The basic idea of object-oriented programming is to view a complex system as the interaction of simpler objects. ·An object consists of -A collection of related information. -A set of operations to manipulate that information. Objects may refer to other objects. Objects interact by sending each other messages (requests for an object to perform one's operations)

The Object of Objects • The basic idea of object-oriented programming is to view a complex system as the interaction of simpler objects. • An object consists of – A collection of related information. – A set of operations to manipulate that information. • Objects may refer to other objects. • Objects interact by sending each other messages (requests for an object to perform one’s operations)

上游充通大 ParisTech SHANGHAI JIAO TONG UNIVERSITY INSTITUT DES SCIENCES ET TECHNOLOGIES PARIS INSTITUTE OF TECHNOLOGY Example:time Specification Old style ·Develop a daily time m hours =6 system - m_minutes 30 Morning-call time 6:30:00 -m_seconds =0 Lunch time 12:00:00 I hours 12 Sport time 18:00:00 -I minutes =0 -Iseconds =0 -s hours =18 -s_minutes 0 -s_seconds =0 printTime (hours,minut es,seconds)

Example: time Specification • Develop a daily time system – Morning-call time 6:30:00 – Lunch time 12:00:00 – Sport time 18:00:00 Old style – m_hours = 6 – m_minutes = 30 – m_seconds = 0 – l_hours = 12 – l_minutes = 0 – l_seconds = 0 – s_hours = 18 – s_minutes = 0 – s_seconds = 0 printTime(hours,minut es,seconds)

上降充通大 ParisTech SHANGHAI JIAO TONG UNIVERSITY INSTITUT DES SCIENCES ET TECHNOLOGIES PARIS INSTITUTE OF TECHNOLOGY Object-Oriented Style Define myTime Create object 。myTime: 。mtime=myTime() hours mtime.hours 6 -minutes mtime.minutes 30 seconds -mtime.seconds 0 ·function ·mtime.printTime() printTime() 。ltime=myTime() ·stime=myTime()

Object-Oriented Style Define myTime • myTime: – hours – minutes – seconds • function – printTime() Create object • mtime = myTime() – mtime.hours = 6 – mtime.minutes = 30 – mtime.seconds = 0 • mtime.printTime() • ltime=myTime() – ... • stime=myTime()

上游充通大学 ParisTech SHANGHAI JIAO TONG UNIVERSITY INSTITUT DES SCIENCES ET TECHNOLOGIES PARIS INSTITUTE OF TECHNOLOGY OOP:a good practice of data structure Data structure Data Operation ·OOP Define a type of objects Data associated with the object Operations applicable on the object - Create and use the object through construction and methods

OOP: a good practice of data structure • Data structure – Data – Operation • OOP – Define a type of objects • Data associated with the object • Operations applicable on the object – Create and use the object through construction and methods

上游充通大 ParisTech SHANGHAI JIAO TONG UNIVERSITY INSTITUT DES SCIENCES ET TECHNOLOGIES PARIS INSTITUTE OF TECHNOLOGY Simple Graphics Programming Most applications you're familiar with have Graphical User Interfaces (GUl)that provide windows,icons,buttons and menus. 74 Celsius Converter ▣☒ Celsius Temperature: 35 Quit Fahrenheit Temperature: 95.0

Simple Graphics Programming • Most applications you’re familiar with have Graphical User Interfaces (GUI) that provide windows, icons, buttons and menus

上游充通大 ParisTech SHANGHAI JIAO TONG UNIVERSITY INSTITUT DES SCIENCES ET TECHNOLOGIES PARIS INSTITUTE OF TECHNOLOGY Simple Graphics Programming Tkinter Python comes with its own standard GUl module called Tkinter. ■graphics.py a simple object oriented graphics library for you Two location choices In Python's Lib directory with other libraries In the same folder as your graphics program

Simple Graphics Programming  Tkinter  Python comes with its own standard GUI module called Tkinter.  graphics.py  a simple object oriented graphics library for you  Two location choices  In Python’s Lib directory with other libraries  In the same folder as your graphics program

上游通大¥ ParisTech SHANGHAI JIAO TONG UNIVERSITY INSTITUT DES SCIENCES ET TECHNOLOGIES PARIS INSTITUTE OF TECHNOLOGY Graphics.py is an OO Packet over Tkinter Graphics is developed over Tkinter and provide object-oriented library to user. graphics GraphWin Point Rectangle Oval circle Line Text Canvas c.create c.create_ c.create_ c.create rectangle oval line text Tkinter

Graphics.py is an OO Packet over Tkinter • Graphics is developed over Tkinter and provide object-oriented library to user

共27页,试读已结束,阅读完整版请下载
刷新页面下载完整文档
VIP每日下载上限内不扣除下载券和下载次数;
按次数下载不扣除下载券;
注册用户24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
相关文档