Under The Guidance of Dr. Kota Solomon Raju Principal Scientist
Under The Guidance of Dr. Kota Solomon Raju Principal Scientist
solomon@ceeri.ernet.in /kota_solomonraju@yahoo.co.uk,
CSIR-CEERI RCS & WSN Labs, Digital Systems Group, CSIR-CEERI, PILANI-333031(Raj),India
OBJECTIVE
To create a GUI automated application for Partial Reconfigurable Region Design Flow
solomon@ceeri.ernet.in /kota_solomonraju@yahoo.co.uk,
CSIR-CEERI RCS & WSN Labs, Digital Systems Group, CSIR-CEERI, PILANI-333031(Raj),India
CONTENTS
1)What is python 2)Properties 3)What is it used for? 4)Who is using it ? 5)Python GUI Programming(tkinter) 6)Example
solomon@ceeri.ernet.in /kota_solomonraju@yahoo.co.uk, CSIR-CEERI RCS & WSN Labs, Digital Systems Group, CSIR-CEERI, PILANI-333031(Raj),India
What is Python?
Python is a high-level, interpreted, interactive and object oriented-scripting language. Python was designed to be highly readable which uses English keywords frequently where as other languages use punctuation and it has fewer syntactical constructions than other languages.
Python is Interpreted: This means that it is processed at runtime by the interpreter and you do not need to compile your program before executing it. This is similar to PERL and PHP. Python is Interactive: This means that you can actually sit at a Python prompt and interact with the interpreter directly to write your programs. Python is Object-Oriented: This means that Python supports Object-Oriented style or technique of programming that encapsulates code within objects.
solomon@ceeri.ernet.in /kota_solomonraju@yahoo.co.uk,
CSIR-CEERI RCS & WSN Labs, Digital Systems Group, CSIR-CEERI, PILANI-333031(Raj),India
Properties
Open Source (OSI Certified) copyrighted but use not restricted no "viral" license owned by independent non-profit, PSF Extremely portable Unix/Linux, Windows, Mac, PalmOS, WindowsCE, RiscOS, VxWorks, QNX, OS/2, OS/390, AS/400, PlayStation, Sharp Zaurus, BeOS, VMS Compiles to interpreted byte code compilation is implicit and automatic Memory management automatic reference counting for most situations GC added for cycle detection Safe: no core dumps due to your bugs
solomon@ceeri.ernet.in /kota_solomonraju@yahoo.co.uk,
CSIR-CEERI RCS & WSN Labs, Digital Systems Group, CSIR-CEERI, PILANI-333031(Raj),India
Rapid Prototyping
Rapid Prototyping (RP) can be defined as a group of techniques used to quickly fabricate a scale model of a part or assembly using three-dimensional computer aided design (CAD) data
. Why prototyping?
The reasons of Rapid Prototyping are To increase effective communication. To decrease development time. To decrease costly mistakes. To minimize sustaining engineering changes. Image Source : http://en.wikiversity.org/wiki/Introduction_to_Rapid_Prototyping To extend product lifetime by adding necessary features and eliminating redundant features & early in the design.
solomon@ceeri.ernet.in /kota_solomonraju@yahoo.co.uk, CSIR-CEERI RCS & WSN Labs, Digital Systems Group, CSIR-CEERI, PILANI-333031(Raj),India
Web Browsing
What is CGI ?
The Common Gateway Interface, or CGI, is a set of standards that define how information is exchanged between the web server and a custom script. The CGI specs are currently maintained by the NCSA and NCSA defines CGI is as follows: The Common Gateway Interface, or CGI, is a standard for external gateway programs to interface with information servers such as HTTP servers. The current version is CGI/1.1 and CGI/1.2 is under progress.
Web Browsing
To understand the concept of CGI, lets see what happens when we click a hyper link to browse a particular web page or URL. Your browser contacts the HTTP web server and demand for the URL ie. filename. Web Server will parse the URL and will look for the filename in if it finds that file then sends back to the browser otherwise sends an error message indicating that you have requested a wrong file. Web browser takes response from web server and displays either the received file or error message.
CSIR-CEERI RCS & WSN Labs, Digital Systems Group, CSIR-CEERI, PILANI-333031(Raj),India
solomon@ceeri.ernet.in /kota_solomonraju@yahoo.co.uk,
solomon@ceeri.ernet.in /kota_solomonraju@yahoo.co.uk,
CSIR-CEERI RCS & WSN Labs, Digital Systems Group, CSIR-CEERI, PILANI-333031(Raj),India
solomon@ceeri.ernet.in /kota_solomonraju@yahoo.co.uk,
CSIR-CEERI RCS & WSN Labs, Digital Systems Group, CSIR-CEERI, PILANI-333031(Raj),India
.
CSIR-CEERI RCS & WSN Labs, Digital Systems Group, CSIR-CEERI, PILANI-333031(Raj),India
solomon@ceeri.ernet.in /kota_solomonraju@yahoo.co.uk,
solomon@ceeri.ernet.in /kota_solomonraju@yahoo.co.uk,
CSIR-CEERI RCS & WSN Labs, Digital Systems Group, CSIR-CEERI, PILANI-333031(Raj),India
solomon@ceeri.ernet.in /kota_solomonraju@yahoo.co.uk,
execute
output
solomon@ceeri.ernet.in /kota_solomonraju@yahoo.co.uk,
CSIR-CEERI RCS & WSN Labs, Digital Systems Group, CSIR-CEERI, PILANI-333031(Raj),India
solomon@ceeri.ernet.in /kota_solomonraju@yahoo.co.uk,
CSIR-CEERI RCS & WSN Labs, Digital Systems Group, CSIR-CEERI, PILANI-333031(Raj),India
Tk Overview
Set of widgets designed by John K. Ousterhout, 1987 Based on Apple Hypercard idea of putting together graphics program Tk == Tool Kit Mean to be driven by Tcl (Toolkit Control Language) Many people find Tcl limited Can also drive Tk with Perl, Python Tkinter is the Python Tk Interface Very easy to use
solomon@ceeri.ernet.in /kota_solomonraju@yahoo.co.uk,
CSIR-CEERI RCS & WSN Labs, Digital Systems Group, CSIR-CEERI, PILANI-333031(Raj),India
Tkinter Programming:
Tkinter is the standard GUI library for Python. Python when combined with Tkinter provides a fast and easy way to create GUI applications. Tkinter provides a powerful object-oriented interface to the Tk GUI toolkit. Creating a GUI application using Tkinter is an easy task. All you need to do is perform the following steps: Example:Import the Tkinter module. Create the GUI application main window. Add one or more of the above mentioned widgets to the GUI application. Enter the main event loop to take action against each event triggered by the user. import Tkinter top = Tkinter.Tk() # Code to add widgets will go here... top.mainloop()
CSIR-CEERI RCS & WSN Labs, Digital Systems Group, CSIR-CEERI, PILANI-333031(Raj),India
solomon@ceeri.ernet.in /kota_solomonraju@yahoo.co.uk,
labels
buttons
solomon@ceeri.ernet.in /kota_solomonraju@yahoo.co.uk,
CSIR-CEERI RCS & WSN Labs, Digital Systems Group, CSIR-CEERI, PILANI-333031(Raj),India
solomon@ceeri.ernet.in /kota_solomonraju@yahoo.co.uk,
CSIR-CEERI RCS & WSN Labs, Digital Systems Group, CSIR-CEERI, PILANI-333031(Raj),India
Example:
import Tkinter import tkMessageBox top = Tkinter.Tk() def helloCallBack(): tkMessageBox.showinfo( "Hello Python", "Hello World") B = Tkinter.Button(top, text ="Hello", command = helloCallBack) B.pack() top.mainloop()
solomon@ceeri.ernet.in /kota_solomonraju@yahoo.co.uk,
CSIR-CEERI RCS & WSN Labs, Digital Systems Group, CSIR-CEERI, PILANI-333031(Raj),India
solomon@ceeri.ernet.in /kota_solomonraju@yahoo.co.uk,
CSIR-CEERI RCS & WSN Labs, Digital Systems Group, CSIR-CEERI, PILANI-333031(Raj),India
Example:
from Tkinter import * import tkMessageBox import Tkinter top = Tkinter.Tk() CheckVar1 = IntVar() CheckVar2 = IntVar() C1 = Checkbutton(top, text onvalue = 1, offvalue C2 = Checkbutton(top, text onvalue = 1, offvalue C1.pack() C2.pack() top.mainloop()
= = = =
"Music", variable = CheckVar1, \ 0, height=5, width = 20) "Video", variable = CheckVar2, \ 0, height=5, width = 20)
solomon@ceeri.ernet.in /kota_solomonraju@yahoo.co.uk,
CSIR-CEERI RCS & WSN Labs, Digital Systems Group, CSIR-CEERI, PILANI-333031(Raj),India
solomon@ceeri.ernet.in /kota_solomonraju@yahoo.co.uk,
CSIR-CEERI RCS & WSN Labs, Digital Systems Group, CSIR-CEERI, PILANI-333031(Raj),India
Example
from Tkinter import *
top = Tk() L1 = Label(top, text="User Name") L1.pack( side = LEFT) E1 = Entry(top, bd =5) E1.pack(side = RIGHT) top.mainloop()
solomon@ceeri.ernet.in /kota_solomonraju@yahoo.co.uk,
CSIR-CEERI RCS & WSN Labs, Digital Systems Group, CSIR-CEERI, PILANI-333031(Raj),India
solomon@ceeri.ernet.in /kota_solomonraju@yahoo.co.uk,
CSIR-CEERI RCS & WSN Labs, Digital Systems Group, CSIR-CEERI, PILANI-333031(Raj),India
Example:
from Tkinter import * root = Tk() var = StringVar() label = Label( root, textvariable=var, relief=RAISED ) var.set("Hey!? How are you doing?") label.pack() root.mainloop()
solomon@ceeri.ernet.in /kota_solomonraju@yahoo.co.uk,
CSIR-CEERI RCS & WSN Labs, Digital Systems Group, CSIR-CEERI, PILANI-333031(Raj),India
solomon@ceeri.ernet.in /kota_solomonraju@yahoo.co.uk,
CSIR-CEERI RCS & WSN Labs, Digital Systems Group, CSIR-CEERI, PILANI-333031(Raj),India
Example:
from Tkinter import * import tkMessageBox import Tkinter top = Tk() Lb1 = Listbox(top) Lb1.insert(1, "Python") Lb1.insert(2, "Perl") Lb1.insert(3, "C") Lb1.insert(4, "PHP") Lb1.insert(5, "JSP") Lb1.insert(6, "Ruby") Lb1.pack() top.mainloop()
solomon@ceeri.ernet.in /kota_solomonraju@yahoo.co.uk, CSIR-CEERI RCS & WSN Labs, Digital Systems Group, CSIR-CEERI, PILANI-333031(Raj),India
solomon@ceeri.ernet.in /kota_solomonraju@yahoo.co.uk,
CSIR-CEERI RCS & WSN Labs, Digital Systems Group, CSIR-CEERI, PILANI-333031(Raj),India
from Tkinter import * def sel(): selection = "You selected the option " + str(var.get()) label.config(text = selection) root = Tk() var = IntVar() R1 = Radiobutton(root, text="Option 1", variable=var, value=1, command=sel) R1.pack( anchor = W ) R2 = Radiobutton(root, text="Option 2", variable=var, value=2,command=sel) R2.pack( anchor = W ) R3 = Radiobutton(root, text="Option 3", variable=var, value=3,command=sel) R3.pack( anchor = W) label = Label(root) label.pack() root.mainloop()
solomon@ceeri.ernet.in /kota_solomonraju@yahoo.co.uk, CSIR-CEERI RCS & WSN Labs, Digital Systems Group, CSIR-CEERI, PILANI-333031(Raj),India
Example
solomon@ceeri.ernet.in /kota_solomonraju@yahoo.co.uk,
CSIR-CEERI RCS & WSN Labs, Digital Systems Group, CSIR-CEERI, PILANI-333031(Raj),India
Example
from Tkinter import * root = Tk() scrollbar = Scrollbar(root) scrollbar.pack( side = RIGHT, fill=Y ) mylist = Listbox(root, yscrollcommand = scrollbar.set ) for line in range(100): mylist.insert(END, "This is line number " + str(line))
solomon@ceeri.ernet.in /kota_solomonraju@yahoo.co.uk,
CSIR-CEERI RCS & WSN Labs, Digital Systems Group, CSIR-CEERI, PILANI-333031(Raj),India
Example:
from Tkinter import * root = Tk() var = StringVar() label = Message( root, textvariable=var, relief=RAISED ) var.set("Hey!? How are you doing?") label.pack() root.mainloop()
solomon@ceeri.ernet.in /kota_solomonraju@yahoo.co.uk,
CSIR-CEERI RCS & WSN Labs, Digital Systems Group, CSIR-CEERI, PILANI-333031(Raj),India
Compared to Perl
Easier to learn especially for infrequent users More readable code improved code maintenance Fewer magical side effects More safety guarantees Better Java integration Some things slower
solomon@ceeri.ernet.in /kota_solomonraju@yahoo.co.uk,
CSIR-CEERI RCS & WSN Labs, Digital Systems Group, CSIR-CEERI, PILANI-333031(Raj),India
Compared to Java
Code 5-10 times more concise Dynamic typing Much quicker development no compilation phase less typing Yes, it runs slower but development is much faster! Ditto (but more so) for C/C++
solomon@ceeri.ernet.in /kota_solomonraju@yahoo.co.uk,
CSIR-CEERI RCS & WSN Labs, Digital Systems Group, CSIR-CEERI, PILANI-333031(Raj),India
Compared to Tcl
Real datatypes, object-orientation More differentiated syntax Much faster (even than Tcl 8.0) Can use threads Less need for C extensions hence fewer extension conflicts Better Java integration Python uses Tk as de-facto GUI std
solomon@ceeri.ernet.in /kota_solomonraju@yahoo.co.uk,
CSIR-CEERI RCS & WSN Labs, Digital Systems Group, CSIR-CEERI, PILANI-333031(Raj),India
JPython
Seamless integration with Java Separate implementation classic Python called CPython here Implements the same language Different set of standard modules differences in gray areas e.g. some different introspection calls different command line options, etc.
solomon@ceeri.ernet.in /kota_solomonraju@yahoo.co.uk,
CSIR-CEERI RCS & WSN Labs, Digital Systems Group, CSIR-CEERI, PILANI-333031(Raj),India
Java integration
Interactive Compiles direct to Java bytecode Import Java classes directly Subclass Java classes pass instances back to Java Java beans integration Can compile into Java class files run as applet in browsers
solomon@ceeri.ernet.in /kota_solomonraju@yahoo.co.uk,
CSIR-CEERI RCS & WSN Labs, Digital Systems Group, CSIR-CEERI, PILANI-333031(Raj),India
Example
solomon@ceeri.ernet.in /kota_solomonraju@yahoo.co.uk,
CSIR-CEERI RCS & WSN Labs, Digital Systems Group, CSIR-CEERI, PILANI-333031(Raj),India
solomon@ceeri.ernet.in /kota_solomonraju@yahoo.co.uk,
CSIR-CEERI RCS & WSN Labs, Digital Systems Group, CSIR-CEERI, PILANI-333031(Raj),India
Recommended Referals
http://en.wikipedia.org/wiki/Python_(programming_language) Http://web.media.mit.edu/~dustin/books/pycs.pdf http://en.wikipedia.org/wiki/Rapid_application_development https://cs.american.edu/~fleck/classes/csc280/spring11/slides/tkinter.ppt http://www.tutorialspoint.com/
solomon@ceeri.ernet.in /kota_solomonraju@yahoo.co.uk,
CSIR-CEERI RCS & WSN Labs, Digital Systems Group, CSIR-CEERI, PILANI-333031(Raj),India