background preloader

Python & Database programming

Facebook Twitter

24.1. Tkinter — Python interface to Tcl/Tk — Python v2.7.3 documentation. The Tkinter module (“Tk interface”) is the standard Python interface to the Tk GUI toolkit.

24.1. Tkinter — Python interface to Tcl/Tk — Python v2.7.3 documentation

Both Tk and Tkinter are available on most Unix platforms, as well as on Windows systems. (Tk itself is not part of Python; it is maintained at ActiveState.) 24.1.1. Tkinter Modules Most of the time, the Tkinter module is all you really need, but a number of additional modules are available as well. In addition to the Tk interface module, Tkinter includes a number of Python modules.

Or, more often: class Tkinter.Tk(screenName=None, baseName=None, className='Tk', useTk=1) The Tk class is instantiated without arguments. Changed in version 2.4: The useTk parameter was added. Tkinter.Tcl(screenName=None, baseName=None, className='Tk', useTk=0) The Tcl() function is a factory function which creates an object much like that created by the Tk class, except that it does not initialize the Tk subsystem. New in version 2.4. Other modules that provide Tk support include: ScrolledText tkColorChooser tkCommonDialog fill. Linguaggio di Programmazione Python. Python - MySQL Database Access. The Python standard for database interfaces is the Python DB-API.

Python - MySQL Database Access

Most Python database interfaces adhere to this standard. You can choose the right database for your application. Python Database API supports a wide range of database servers such as − GadFlymSQLMySQLPostgreSQLMicrosoft SQL Server 2000InformixInterbaseOracleSybase Here is the list of available Python database interfaces: Python Database Interfaces and APIs .You must download a separate DB API module for each database you need to access. The DB API provides a minimal standard for working with databases using Python structures and syntax wherever possible. Importing the API module.Acquiring a connection with the database.Issuing SQL statements and stored procedures.Closing the connection We would learn all the concepts using MySQL, so let us talk about MySQLdb module. What is MySQLdb?

MySQLdb is an interface for connecting to a MySQL database server from Python. How do I Install MySQLdb? #! Database Connection Example #! #! #! #! #! #! #! Snyppets - Python snippets. Pt This page contains a bunch of miscellaneous Python code snippets, recipes, mini-guides, links, examples, tutorials and ideas, ranging from very (very) basic things to advanced. Snyppets - Python snippets

I hope they will be usefull to you. All snippets are kept in a single HTML page so that you can easily ❶save it for offline reading (and keep on a USB key) ❷search in it. Note that scripts that do some web-scraping may not work anymore due to website changes. The web is an evolving beast :-) (Don't forget to read my main Python page ( ): there is handful of other programs and a guides.) Advertising To avoid dodgy websites,install WOT Send a file using FTP Piece of cake. import ftplib # We import the FTP module session = ftplib.FTP('','login','passord') # Connect to the FTP server myfile = open('toto.txt','rb') # Open the file to send session.storbinary('STOR toto.txt', myfile) # Send the file myfile.close() # Close the file session.quit() # Close FTP session Queues (FIFO) and stacks (LIFO) Still hungry ? #! Tkinter 8.4 reference: a GUI for Python.