上降充通大 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