background preloader

GUI

Facebook Twitter

Functional Programming HOWTO — Python v2.6a2 documentation. In this document, we’ll take a tour of Python’s features suitable for implementing programs in a functional style. After an introduction to the concepts of functional programming, we’ll look at language features such as iterators and generators and relevant library modules such as itertools and functools. Introduction This section explains the basic concept of functional programming; if you’re just interested in learning about Python language features, skip to the next section on Iterators. Programming languages support decomposing problems in several different ways: Most programming languages are procedural: programs are lists of instructions that tell the computer what to do with the program’s input.

C, Pascal, and even Unix shells are procedural languages.In declarative languages, you write a specification that describes the problem to be solved, and the language implementation figures out how to perform the computation efficiently. Formal provability Modularity Composability Iterators. GUI | Guida Python | Programmazione.HTML.it. Nota: lezione in aggiornamento In questo articolo vediamo come utilizzare Python anche per costruire applicazioni con interfaccia grafica a finestre, menu, bottoni e tutto il resto. Quanto esaminato finora è utile per costruire degli script da eseguire sulla linea di comando, ma con Python si può osare di più.

Sono stati implementati diversi moduli che permettono di aggiungere ad un programma Python una GUI. In particolare abbiamo a disposizione 3 librerie: Tkinter, Win32Extension,WxPython. Tkinter Tkinter è un modulo che permette di interfacciare Python a X-Windows. Questa libreria deve essere utilizzata da coloro che intendono sviluppare interfacce grafiche multipiattaforma, quindi programmi che devono girare su unix, linux, windows e anche per Mac. Questa libreria ha il vantaggio di essere già compresa nella installazione standard, quindi non sono necessarie installazioni aggiuntive per iniziare a lavorare con l’interfaccia grafica. Vediamo il listato completo del programma: Win32Extension. Creating a GUI in Python using Tkinter. Up until now we’ve focused on python applications that only run in the command line. For a lot of tasks this is great, but in order to be really impressive we’re going to want to create a GUI for some of our python applications. There are a lot of python GUI toolkits out there, but for our first application we are going to use Tkinter, which is considered somewhat of a standard right now and is installed when pyhon is installed.

Another nice thing about the Tkinter GUI is that it is cross platform and offers a native look and feel on *nix, Windows, and OS X. Tkinter Example One So lets start off with a simply “Hello World” GUI app: from Tkinter import * class GUIFramework(Frame): """This is the GUI""" def __init__(self,master=None): """Initialize""" """Initialize the base class""" Frame. Running this on OS X results in the following: And running it in Windows Xp gives you: There we first initialize the base class (which will initialize Tkinter) and then tell ourselves to be visible: MySQLdb: un'interfaccia Python per MySQL: Introduzione. Avanti Indietro Indice 1. Introduzione Questo modulo dovrebbe essere nella maggioranza dei casi compatibile con un'interfaccia più datata, scritta da Joe Skinner e altri.

In ogni caso, tale versione dell'interfaccia è a) antipatica da usare con i thread (le operazioni di un thread sul database potrebbero bloccare tutti gli altri thread), b) scritta per MySQL 3.21 (e di suo non compila sulle versioni più recenti), c) non più attivamente mantenuta secondo ogni evidenza. 1.1 Piattaforme Linux/UNIX Questo modulo viene sviluppato su Linux RedHat (attualmente 7.1) per Intel. Windows (3.11, 95, 98, NT, 2000, CE, BSOD, XYZ, ecc.) La piattaforma Windows non è supportata. 1.2 Python MySQLdb richiede Python 1.5.2 o successivo. 1.3 MySQL MySQL-3.22 Si garantisce il funzionamento solo a partire dalla versione 3.22.32 di MySQL. MySQL-3.22 sembra avere un problema quando si tenta di inserire valori TIME con i secondi come frazioni. MySQL-3.23 MySQL-3.23 ora è stabile (3.23.37 al momento della stesura).

Italiano: Computer: Programmazione: Python. Pensare da informatico: Imparare con Python. Python 201 -- (Slightly) Advanced Python Topics. Dave Kuhlman Email: dkuhlman@rexx.com Release 1.00June 6, 2003 Copyright (c) 2003 Dave Kuhlman Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

Abstract: This document is a syllabus for a second course in Python programming. Contents This document is intended as notes for a course on (slightly) advanced Python topics. Defining a regular expression is to provide a sequence of characters, the pattern, that will match sequences of characters in a target. Comments: Python for Fun. This collection is a presentation of several small Python programs. They are aimed at intermediate programmers; people who have studied Python and are fairly comfortable with basic recursion and object oriented techniques. Each program is very short, never more than a couple of pages and accompanied with a write-up.

I have found Python to be an excellent language to express algorithms clearly. Some of the ideas here originated in other programs in other languages. But in most cases I developed code from scratch from just an outline of an idea. However Lisp in Python was almost a translation exercise from John McCarthy's original Evalquote in Lisp.

From many years of programming these are some of my favorite programs. Chris Meyers.