<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.campisano.org/wiki/Pygtk/history?feed=atom</id>
	<title>Pygtk - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.campisano.org/wiki/Pygtk/history?feed=atom"/>
	<link rel="alternate" type="text/html" href="https://www.campisano.org/wiki/Pygtk/history"/>
	<updated>2026-07-04T23:35:36Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.9</generator>
	<entry>
		<id>https://www.campisano.org/mediawiki/index.php?title=Pygtk&amp;diff=1140&amp;oldid=prev</id>
		<title>imported&gt;T1t0 at 03:21, 8 July 2018</title>
		<link rel="alternate" type="text/html" href="https://www.campisano.org/mediawiki/index.php?title=Pygtk&amp;diff=1140&amp;oldid=prev"/>
		<updated>2018-07-08T03:21:53Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 03:21, 8 July 2018&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l84&quot;&gt;Line 84:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 84:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* http://www.campisano.org/files/testPureMVC.tar.gz&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* http://www.campisano.org/files/testPureMVC.tar.gz&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;(Convertitore di base decimale-&amp;gt;esadecimale-&amp;gt;binario ecc.)&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;(Convertitore di base decimale-&amp;gt;esadecimale-&amp;gt;binario ecc.)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Category:develop]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Category:python]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Category:to_translate]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>imported&gt;T1t0</name></author>
	</entry>
	<entry>
		<id>https://www.campisano.org/mediawiki/index.php?title=Pygtk&amp;diff=1139&amp;oldid=prev</id>
		<title>imported&gt;T1t0 at 07:11, 8 June 2012</title>
		<link rel="alternate" type="text/html" href="https://www.campisano.org/mediawiki/index.php?title=Pygtk&amp;diff=1139&amp;oldid=prev"/>
		<updated>2012-06-08T07:11:56Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 07:11, 8 June 2012&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l78&quot;&gt;Line 78:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 78:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  git add --all # optional&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  git add --all # optional&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  git commit -m &amp;quot;initial structure added&amp;quot; # optional&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  git commit -m &amp;quot;initial structure added&amp;quot; # optional&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Un esempio non troppo complicato é il seguente:&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;* http://www.campisano.org/files/testPureMVC.tar.gz&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;(Convertitore di base decimale-&amp;gt;esadecimale-&amp;gt;binario ecc.)&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>imported&gt;T1t0</name></author>
	</entry>
	<entry>
		<id>https://www.campisano.org/mediawiki/index.php?title=Pygtk&amp;diff=1141&amp;oldid=prev</id>
		<title>imported&gt;T1t0: Created page with &quot;Una notte insonne può rendere qualche cosa.   Stavo cercando una alternativa al C++ per produrre rapidamente qualche utility con interfaccia grafica; l&#039;idea era di creare app...&quot;</title>
		<link rel="alternate" type="text/html" href="https://www.campisano.org/mediawiki/index.php?title=Pygtk&amp;diff=1141&amp;oldid=prev"/>
		<updated>2012-05-06T06:38:19Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;Una notte insonne può rendere qualche cosa.   Stavo cercando una alternativa al C++ per produrre rapidamente qualche utility con interfaccia grafica; l&amp;#039;idea era di creare app...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Una notte insonne può rendere qualche cosa.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Stavo cercando una alternativa al C++ per produrre rapidamente qualche utility con interfaccia grafica; l&amp;#039;idea era di creare applicazioni semplici allo stesso tipo dei script bash che si trovano in queste pagine, ma utilizzare un interfaccia grafica per permettere all&amp;#039;utente di inserire o modificare agilmente più cose. Un esempio potrebbe essere un interfaccia grafica al comando mencoder il quale (definendo molte opzioni) permette di (de)codificare video e dvd.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dopo una disperata ricerca dove avrei voluto scegliere linguaggi come PERL o RUBY, ho scelto per iniziare PYTHON perché sembrerebbe facile da apprendere e molto usato (da GOOGLE per esempio) e perciò con un futuro promettente. Per rendere la cosa più interessante ho aggiunto il framework PureMVC che è disponibile per tutti i linguaggi citati (C++ compreso).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Python + GTK (pygtk) con Glade e PureMVC: 6/8 ore&lt;br /&gt;
&lt;br /&gt;
*([http://www.pygtk.org/pygtk2tutorial/ http://www.pygtk.org/pygtk2tutorial/])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Requisiti (in ambiente Debian-like):&lt;br /&gt;
 apt-get install python-gtk2 python-glade2 glade python-wxgtk2.8&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ho usato Debian stable (squeeze 6.0) e Geany come editor, non ho trovato IDE più utili o più interessanti. Utilizzo inoltre git come repository locale per avere lo storico dei cambiamenti, con gitg come GUI e diffuse come comparatore (anche se giudico kdiff3 superiore)&lt;br /&gt;
 apt-get install git gitg diffuse&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Prima tappa: preparare l&amp;#039;ambiente&lt;br /&gt;
&lt;br /&gt;
 mkdir pygtk # una directory di lavoro&lt;br /&gt;
 cd pygtk&lt;br /&gt;
 git init . # optional: crea il repository&lt;br /&gt;
 echo \*.pyc &amp;gt; .gitignore # optional: git non considererà i file precompilati generati da python&lt;br /&gt;
 git add .gitignore # optional&lt;br /&gt;
 git commit -m &amp;quot;.gitignore: *.pyc&amp;quot; # optional&lt;br /&gt;
 wget http://puremvc.org/pages/downloads/Python/PureMVC_Python.zip&lt;br /&gt;
 unzip PureMVC_Python.zip&lt;br /&gt;
 mv PureMVC_Python_1_2/src/puremvc .&lt;br /&gt;
 rm -Rf PureMVC_Python.zip PureMVC_Python_1_2&lt;br /&gt;
 git add puremvc # optional&lt;br /&gt;
 git commit -m &amp;quot;puremvc added&amp;quot; # optional&lt;br /&gt;
 geany main.py&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Struttura del programma&lt;br /&gt;
&lt;br /&gt;
Grazie al framework PureMVC avremo i sorgenti del programma bem divisi in sottocartelle, divise per concetto di layers: la parte del programma che si occupa di interfacciarsi con l&amp;#039;utente (ui_gtk), la parte che ottenuta l&amp;#039;azione dell&amp;#039;utente chiama un comando (view), il comando che verifica lo stato e i parametri ottenuti e modifica lo stato del programma e i dati (controller), la parte che fornisce i dati al comando e che il comando chiama per modificare i dati (model) e che può notificare il cambiamento dei dati alla parte che chiamò il comando (view) e che può quindi informare i cambiamenti all&amp;#039;interfaccia grafica (ui_gtk).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
avremo quindi:&lt;br /&gt;
&lt;br /&gt;
 pygtk/&lt;br /&gt;
       application/&lt;br /&gt;
       controller/&lt;br /&gt;
       define/&lt;br /&gt;
       domain/&lt;br /&gt;
       dto/&lt;br /&gt;
       model/&lt;br /&gt;
       puremvc/&lt;br /&gt;
       ui/&lt;br /&gt;
       ui_gtk/&lt;br /&gt;
       ui_wx/&lt;br /&gt;
       view/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Come avrete notato ho aggiunto qualche directory in più: PureMVC separa così bene il programma che ci permette di utilizzare diverse interfacce grafiche (in questo caso GTK o WxWidget). Per far questo ho definito interfaces alle classi che inizializzano la parte grafica e mostrano la finestra del programma. In questo modo potrei aggiungere un file di configurazione per scegliere se utilizare una o l&amp;#039;altra libreria grafica. Per questo esempio instanzio la classe specifica dell&amp;#039;interfaccia GTK nel file main.py e la passo alla classe application/Application.py che si occupa di inizializzare la parte grafica e il framework PureMVC. Ho messo quindi nella directory ui/ le intrefaces e in ui_gtk/ e ui_wx/ le classi grafiche specifiche. Nella directory define/ ho aggiunto un file comune, usato in varie classi, per definire i nomi degli eventi ai quali voglio associare una determinata azione. Nella directory domain ho messo le classi che si occupano di fare il lavoro vero e proprio (per esempio nel caso di un programma per convertire i video ci si troverebbe la classe Converter che si occuperebbe di chiamare il comando mencoder con le opzioni corrette). Nella directory dto/ ho messo delle classi che utilizzo solamente per trasferire comodamente informazioni da una parte all&amp;#039;altra del programma (Data Transfer Object, vedi anche POCO o POJO).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Sembra tutto più complicato, ma in realtà è solamente ben organizzato, in modo che il programma può crescere (si possono aggiungere finestre, funzionalità, ecc) senza che diventi un miscuglio irriconoscibile.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Seconda tappa: preparare la struttura.&lt;br /&gt;
&lt;br /&gt;
Non ho capito bene come funziona python in questa cosa: sembrerebbe che se organizzo il programma in cartelle (e in realtà in pacchetti) lui vuole che per ogni cartella esista un file con il nome __init__.py , perciò senza perderci troppo tempo creiamo questa struttura:&lt;br /&gt;
&lt;br /&gt;
 for DIR in application controller define dto domain model ui ui_gtk ui_wx view; do mkdir $DIR; touch $DIR/__init__.py; done&lt;br /&gt;
 git add --all # optional&lt;br /&gt;
 git commit -m &amp;quot;initial structure added&amp;quot; # optional&lt;/div&gt;</summary>
		<author><name>imported&gt;T1t0</name></author>
	</entry>
</feed>