dvadf
/home/homerdlh/public_html/1ef9ad/tkinter.zip
PK�
Q\
Cx�jjguido/paint.pynu�[���""""Paint program by Dave Michell.

Subject: tkinter "paint" example
From: Dave Mitchell <davem@magnet.com>
To: python-list@cwi.nl
Date: Fri, 23 Jan 1998 12:18:05 -0500 (EST)

  Not too long ago (last week maybe?) someone posted a request
for an example of a paint program using Tkinter. Try as I might
I can't seem to find it in the archive, so i'll just post mine
here and hope that the person who requested it sees this!

  All this does is put up a canvas and draw a smooth black line
whenever you have the mouse button down, but hopefully it will
be enough to start with.. It would be easy enough to add some
options like other shapes or colors...

                                                yours,
                                                dave mitchell
                                                davem@magnet.com
"""

from Tkinter import *

"""paint.py: not exactly a paint program.. just a smooth line drawing demo."""

b1 = "up"
xold, yold = None, None

def main():
    root = Tk()
    drawing_area = Canvas(root)
    drawing_area.pack()
    drawing_area.bind("<Motion>", motion)
    drawing_area.bind("<ButtonPress-1>", b1down)
    drawing_area.bind("<ButtonRelease-1>", b1up)
    root.mainloop()

def b1down(event):
    global b1
    b1 = "down"           # you only want to draw when the button is down
                          # because "Motion" events happen -all the time-

def b1up(event):
    global b1, xold, yold
    b1 = "up"
    xold = None           # reset the line when you let go of the button
    yold = None

def motion(event):
    if b1 == "down":
        global xold, yold
        if xold is not None and yold is not None:
            event.widget.create_line(xold,yold,event.x,event.y,smooth=TRUE)
                          # here's where you draw it. smooth. neat.
        xold = event.x
        yold = event.y

if __name__ == "__main__":
    main()
PK�
Q\��kK�\�\guido/sortvisu.pycnu�[����
Afc@s�dZddlTddlmZmZddlZdZdZdZddd��YZ	d	dd
��YZ
d�Zd�Zd
�Z
d�Zd�Zd�Zd�Zd�Zd�Zd�Zddd��YZd�Zedkr�e�ndS(sjSorting algorithms visualizer using Tkinter.

This module is comprised of three ``components'':

- an array visualizer with methods that implement basic sorting
operations (compare, swap) as well as methods for ``annotating'' the
sorting algorithm (e.g. to show the pivot element);

- a number of sorting algorithms (currently quicksort, insertion sort,
selection sort and bubble sort, as well as a randomization function),
all using the array visualizer for its basic operations and with calls
to its annotation methods;

- and a ``driver'' class which can be used as a Grail applet or as a
stand-alone application.

i����(t*(tLinet	RectangleNi
itArraycBs�eZdd�Zd�ZdZd�Zd�ZdZdZ	d�Z
d�ZdZd	�Z
d
�Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�ZRS(cCs||_t|j�|_|jjdt�t|j�|_|jj�t|j�|_|jj�t|j�|_	|j	j�t
|jdddd�|_t
|jdddd�|_t
|jdddd�|_
g|_d|_|_|r|j|�ndS(Ntfilli(tmastertFrametframetpacktXtLabeltlabeltCanvastcanvastreportRtlefttrighttpivottitemstsizetmaxvaluetsetdata(tselfRtdata((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyt__init__"s 	


	cCs�|j}g|_x|D]}|j�qWt|�|_t|�|_|jjd|jdtd|jdt	�x7t
|j�D]&}|jjt||||��q�W|j
d|j�dS(NtwidthitheightsSort demo, size %d(RtdeletetlenRtmaxRR
tconfigtXGRIDtYGRIDtrangetappendt	ArrayItemtreset(RRtolditemstitemti((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyR4s		
$tnormalcCs
||_dS(N(tspeed(RR)((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pytsetspeedCscCs|jj�dS(N(Rtdestroy(R((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyR+FsicCs&d|_|jr"|jj�ndS(Ni(t
stop_mainlooptin_mainloopRtquit(R((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pytcancelLs		cCs|jr|jj�ndS(N(R-RR.(R((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pytstepQs	sArray.CancelledcCs�|jdkrd}n4|jdkr4|d}n|jdkrLd}n|js�|jj�|jj||jj�}d|_|jj�|jj|�d|_n|jr�d|_|j	d�t
j�ndS(	Ntfastestitfasti
ssingle-stepiʚ;it	Cancelled(R)R,RtupdatetafterR.R-tmainlooptafter_canceltmessageRR3(Rtmsecstid((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pytwaitWs"	
		
	
		
cCs|jS(N(R(R((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pytgetsizejscCszxit|j�D]X}|j|}||ko:|knrU|jjdd�q|jjdd�qW|j�dS(NRtredtorange(R!RRR&Rthide_left_right_pivot(RtfirsttlastR'R&((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pytshow_partitionms
cCsHx7t|j�D]&}|j|}|jjdd�qW|j�dS(NRR=(R!RRR&RR?(RR'R&((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pythide_partitionvs
cCs�d|ko|jkns-|j�dS|j|j�\}}}}|jj|ddf|ddfg�|jj�dS(Niii'(Rt	hide_leftRtpositionRtcoordsRR4(RRtx1ty1tx2ty2((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyt	show_left|s
*cCs�d|ko|jkns-|j�dS|j|j�\}}}}|jj|ddf|ddff�|jj�dS(Niii'(Rt
hide_rightRRERRFRR4(RRRGRHRIRJ((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyt
show_right�s
*cCs"|j�|j�|j�dS(N(RDRLt
hide_pivot(R((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyR?�s

cCs|jjddf�dS(Ni(ii(ii(RRF(R((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyRD�scCs|jjddf�dS(Ni(ii(ii(RRF(R((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyRL�scCsM|j|j�\}}}}|jjd|dfd|dff�dS(Niii'(RRERRF(RRRGRHRIRJ((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyt
show_pivot�scCs|jjddf�dS(Ni(ii(ii(RRF(R((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyRN�scCs`||krdS|j�|j|}|j|}|||j|<|j|<|j|�dS(N(t	countswapRtswapwith(RR'tjR&tother((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pytswap�s


cCs1|j�|j|}|j|}|j|�S(N(tcountcompareRt	compareto(RR'RRR&RS((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pytcompare�s


cCs7d|_d|_|j|�|j�|j�dS(Ni(t	ncomparestnswapsR8tupdatereportRC(Rtmsg((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyR$�s
		

cCs|jjd|�dS(Nttext(RR(RR[((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyR8�scCs|jd|_|j�dS(Ni(RYRZ(R((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyRP�scCs|jd|_|j�dS(Ni(RXRZ(R((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyRU�scCs-d|j|jf}|jjd|�dS(Ns%d cmps, %d swapsR\(RXRYRR(RR\((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyRZ�sN(t__name__t
__module__tNoneRRR)R*R+R-R,R/R0R3R;R<RBRCRKRMR?RDRLRORNRTRWR$R8RPRURZ(((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyR s8	
																							R#cBsbeZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�ZRS(
cCs�||_||_||_|j�\}}}}t|j||||dddddd�|_|jjd|j�|jjd|j	�|jjd	|j
�dS(
NRR=toutlinetblackRis
<Button-1>s<Button1-Motion>s<ButtonRelease-1>(tarraytindextvalueRERR
R&tbindt
mouse_downt
mouse_movetmouse_up(RRbRcRdRGRHRIRJ((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyR�s			cCs)|j}d|_d|_|j�dS(N(R&R_RbR(RR&((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyR�s			cCsA|j|_|j|_|j|_|j|_|jj�dS(N(txtlastxtytlastytorigxtorigyR&ttkraise(Rtevent((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyRf�s
cCsC|jj|j|j|j|j�|j|_|j|_dS(N(R&tmoveRiRjRkRl(RRp((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyRg�s'c	Cs�|j|j�}||jj�kr=|jj�d}n|dkrRd}n|jj|}|j}|||jj|<|jj|<||_|j�\}}}}|jj||f||ff�|j	|�dS(Nii(
tnearestindexRiRbR<RRcRER&RFtsetindex(	RRpR'RSthereRGRHRIRJ((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyRh�s		!	"cCs�t|j|�}|sdS|jjdkr7d}n|j�}||_|j�}t|||�}|jj�x<|D]4}|jj|d |df�|jj	d�q~WdS(NR1iii2(
tstepsRcRbR)REtinterpolateR&RoRFR;(RRctnstepstoldptstnewptst
trajectorytpts((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyRs�s		

cCs�t|j|j�}|sdS|jjdkr:d}n|j�}|j�}|j|j|_|_|j�}|j�}|jd}|jd}|jjdd�|jjdd�|jjj�|jjdkrk|jj	|d |df�|jj	|d |df�|jjj�|jjd|�|jjd|�|jj
d�dSt|||�}	t|||�}
|j|jkr�|jj
�|jj
�n|jj
�|jj
�z�xztt|	��D]f}|	|}|
|}
|jj	|d |df�|jj	|
d |
df�|jj
d�q�WWd|	d	}|
d	}
|jj	|d |df�|jj	|
d |
df�|jjd|�|jjd|�XdS(
NR1iRtgreentyellowssingle-stepii2i����(RuRcRbR)RER&RRR4RFR;RvRdRoR!R(RRSRwtmyoldptstotheroldptstmynewptstothernewptstmyfillt	otherfilltmytrajectorytothertrajectoryR'tmyptstotherpts((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyRQ�sV	








cCs�|jd}|jd}t|j|j�}|dkrJd}d}n%|dkred}d}n
d}}z:|jjd|�|jjd|�|jjd�Wd|jjd|�|jjd|�X|S(NRitwhiteRatgreyi�(R&tcmpRdRRbR;(RRSR�R�toutcometmyflasht
otherflash((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyRV-s"

		
cCsX|jdttd}|t}|jjdt}||jt}||||fS(Nii(RcRtWIDTHRbRR Rd(RRGRIRJRH((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyREBs

cCsttt|�t��dS(Ni(tinttroundtfloatR(RRi((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyRrIs(R]R^RRRfRgRhRsRQRVRERr(((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyR#�s							.		cCs[t||�}|dkr)|d}n.|dkrB|d}n|dkrWd}n|S(Niiii
(tabs(RttthereRw((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyRuOs

	cCs�t|�t|�kr$td�ndgt|�}t|�g}xmtd|�D]\}x@tt|��D],}||||||||||<qoW|jt|��qVW|jt|��|S(Ns,can't interpolate arrays of different lengthii(Rt
ValueErrorttupleR!R"(RxRytnR{tresR'tk((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyRvYs*cCs=|j�}|j|ddg|�|jd|�dS(NiisUniform data, size %d(R<RR$(RbR((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pytuniformhscCs;|j�}|jtd|d��|jd|�dS(NisDistinct data, size %d(R<RR!R$(RbR((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pytdistinctmscCsg|jd�|j�}x:t|�D],}tjd|d�}|j||�q&W|jd�dS(NtRandomizingiit
Randomized(R$R<R!trandomtrandintRTR8(RbR�R'RR((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyt	randomizers
cCs�|j�}|jd�xrtd|�D]a}|d}xN|dkr�|j||d�dkrhPn|j||d�|d}q<Wq)W|jd�dS(NsInsertion sortiitSorted(R<R$R!RWRTR8(RbRR'RR((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyt
insertionsortzs

cCs�|j�}|jd�z�xmt|�D]_}|j||�xFt|d|�D]1}|j||�dkrS|j||�qSqSWq)W|jd�Wd|j�XdS(NsSelection sortiiR�(R<R$R!RBRWRTR8RC(RbRR'RR((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyt
selectionsort�s
cCs�|j�}|jd�xat|�D]S}xJtd|�D]9}|j|d|�dkr<|j|d|�q<q<Wq&W|jd�dS(NsBubble sortiiR�(R<R$R!RWRTR8(RbRR'RR((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyt
bubblesort�s
c
Cs�|j�}|jd�zYd|fg}x6|rc|d\}}|d=|j||�||dkr�|jd�xvt|d|�D]a}|d}xN||kr�|j||d�dkr�Pn|j||d�|d}q�Wq�Wq.n|jd�|||d|d}}}|j||�dkrO|j||�n|j||�dkrz|j||�n|j||�dkr�|j||�n|}|j|�|jd	�|jd
�|}	|}
x
|jd�|
d}
|j	|
�x?|
|krF|j|
|�dkrF|
d}
|j	|
�qW|jd�|	d}	|j
|	�x?|	|kr�|j|	|�dkr�|	d}	|j
|	�qnW|	|
kr�|jd
�Pn|jd�|j|	|
�q�W|jd�|j||
�|
|}||	}|dkr>|j||
f�n|dkr.|j|	|f�q.q.W|jd�Wd|j�XdS(Nt	Quicksortii����isInsertion sortisChoosing pivotisPivot at left of partitioni�sSweep right pointersSweep left pointersEnd of partitions
Swap itemssSwap pivot backR�(
R<R$RBR8R!RWRTROR;RMRKR"RC(
RbRtstackR@RAR'RRR�RRRtn1tn2((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyt	quicksort�sx
	


 





'



'





cCs<x5x.ttttgD]}t|�||�qWqWdS(N(R�R�R�R�R�(Rbtalg((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pytdemosort�s
tSortDemocBs�eZdd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
d
�Zd�ZRS(icCs||_||_d|_t|j�|_t|�|_|jjdt�t|j�|_	|j	jdt
dt�t|j�|_|jjdt
dt�t|j	ddd|j�|_|jjdt�t|j	ddd|j�|_|jjdt�t|j	ddd|j�|_|jjdt�t|j	dd	d|j�|_|jjdt�d
tfd��Y}||j|�|_|jj|�dd
ddgtddd�}|j|kr�|j|j�|j�ntt|j	|jft |��|_!|j!jdt�t"|j�|_#|j#jd�t|j	|j#dddd�|_$|j$jdt�t|j	ddd|j%�|_&|j&jdt�t|jddd|j'�|_(|j(jdt�t|jddd|j)�|_*|j*jdt�t|jddd|j+�|_,|j,jdt�t|jddd|j-�|_.|j.jdt�t|jddd|j/�|_0|j0jdt�|j0j1dt2�t|jddd|j3�|_4|j4jdt�dS(NitsideRR\R�tcommandsInsertion sortsSelection sortsBubble sorttMyIntVarcBseZd�Zd�ZRS(cSs||_tj||�dS(N(tdemotIntVarR(RRR�((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyRs	cSs9tj||�t|�dkr5|jj|�ndS(Nt0(R�tsettstrR�tresize(RRd((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyR�s(R]R^RR�(((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyR��s	iiiiii7R(ssingle-stepR2R1tStept	RandomizetUniformtDistincttDemotCanceltstatetQuit(5RRtbusyRRbRtbotframeRtBOTTOMtbotleftframetLEFTtYt
botrightframetRIGHTtButtontc_qsorttb_qsortR	tc_isorttb_isorttc_ssorttb_ssorttc_bsorttb_bsortR�tv_sizeR�R!R"tsorttapplyt
OptionMenuR�tm_sizet	StringVartv_speedtm_speedtc_steptb_steptc_randomizetb_randomizet	c_uniformt	b_uniformt
c_distinctt
b_distincttc_demotb_demotc_canceltb_cancelRtDISABLEDtc_quittb_quit(RRRR�tsizes((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyR�sv				"
"cCsG|jr|jj�dS||_|jjtd|jd��dS(Ni(R�RtbellRRbRR!(Rtnewsize((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyR�0s
	
	cCs|jt�dS(N(trunR�(R((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyR�7scCs|jt�dS(N(R�R�(R((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyR�:scCs|jt�dS(N(R�R�(R((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyR�=scCs|jt�dS(N(R�R�(R((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyR�@scCs|jt�dS(N(R�R�(R((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyR�CscCs|jt�dS(N(R�R�(R((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyR�FscCs|jt�dS(N(R�R�(R((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyR�IscCs|jt�dS(N(R�R�(R((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyR�LscCs�|jr|jj�dSd|_|jj|jj��|jjdt	�y||j�Wnt
jk
rvnX|jjdt�d|_dS(NiR�i(
R�RR�RbR*R�tgetR�RtNORMALRR3R�(Rtfunc((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyR�Os	
	cCs+|js|jj�dS|jj�dS(N(R�RR�RbR/(R((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyR�]s	
cCsK|js|jj�dS|jjd�|jjd�|jj�dS(Nssingle-step(R�RR�R�R�RbR*R0(R((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyR�cs	
cCs3|jr|jj�n|jj|jj�dS(N(R�RbR/Rt
after_idleR.(R((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyR�ks	(R]R^RR�R�R�R�R�R�R�R�R�R�R�R�R�(((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyR��sL												cCs6t�}t|�}|jd|j�|j�dS(NtWM_DELETE_WINDOW(tTkR�tprotocolR�R6(trootR�((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pytmainss	t__main__((((t__doc__tTkinterRRRR�RR R�RR#RuRvR�R�R�R�R�R�R�R�R�R�R](((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyt<module>s,
��	
						
			=		�	PK�
Q\ե�))guido/hanoi.pynu�[���# Animated Towers of Hanoi using Tk with optional bitmap file in
# background.
#
# Usage: tkhanoi [n [bitmapfile]]
#
# n is the number of pieces to animate; default is 4, maximum 15.
#
# The bitmap file can be any X11 bitmap file (look in
# /usr/include/X11/bitmaps for samples); it is displayed as the
# background of the animation.  Default is no bitmap.

# This uses Steen Lumholt's Tk interface
from Tkinter import *


# Basic Towers-of-Hanoi algorithm: move n pieces from a to b, using c
# as temporary.  For each move, call report()
def hanoi(n, a, b, c, report):
    if n <= 0: return
    hanoi(n-1, a, c, b, report)
    report(n, a, b)
    hanoi(n-1, c, b, a, report)


# The graphical interface
class Tkhanoi:

    # Create our objects
    def __init__(self, n, bitmap = None):
        self.n = n
        self.tk = tk = Tk()
        self.canvas = c = Canvas(tk)
        c.pack()
        width, height = tk.getint(c['width']), tk.getint(c['height'])

        # Add background bitmap
        if bitmap:
            self.bitmap = c.create_bitmap(width//2, height//2,
                                          bitmap=bitmap,
                                          foreground='blue')

        # Generate pegs
        pegwidth = 10
        pegheight = height//2
        pegdist = width//3
        x1, y1 = (pegdist-pegwidth)//2, height*1//3
        x2, y2 = x1+pegwidth, y1+pegheight
        self.pegs = []
        p = c.create_rectangle(x1, y1, x2, y2, fill='black')
        self.pegs.append(p)
        x1, x2 = x1+pegdist, x2+pegdist
        p = c.create_rectangle(x1, y1, x2, y2, fill='black')
        self.pegs.append(p)
        x1, x2 = x1+pegdist, x2+pegdist
        p = c.create_rectangle(x1, y1, x2, y2, fill='black')
        self.pegs.append(p)
        self.tk.update()

        # Generate pieces
        pieceheight = pegheight//16
        maxpiecewidth = pegdist*2//3
        minpiecewidth = 2*pegwidth
        self.pegstate = [[], [], []]
        self.pieces = {}
        x1, y1 = (pegdist-maxpiecewidth)//2, y2-pieceheight-2
        x2, y2 = x1+maxpiecewidth, y1+pieceheight
        dx = (maxpiecewidth-minpiecewidth) // (2*max(1, n-1))
        for i in range(n, 0, -1):
            p = c.create_rectangle(x1, y1, x2, y2, fill='red')
            self.pieces[i] = p
            self.pegstate[0].append(i)
            x1, x2 = x1 + dx, x2-dx
            y1, y2 = y1 - pieceheight-2, y2-pieceheight-2
            self.tk.update()
            self.tk.after(25)

    # Run -- never returns
    def run(self):
        while 1:
            hanoi(self.n, 0, 1, 2, self.report)
            hanoi(self.n, 1, 2, 0, self.report)
            hanoi(self.n, 2, 0, 1, self.report)
            hanoi(self.n, 0, 2, 1, self.report)
            hanoi(self.n, 2, 1, 0, self.report)
            hanoi(self.n, 1, 0, 2, self.report)

    # Reporting callback for the actual hanoi function
    def report(self, i, a, b):
        if self.pegstate[a][-1] != i: raise RuntimeError # Assertion
        del self.pegstate[a][-1]
        p = self.pieces[i]
        c = self.canvas

        # Lift the piece above peg a
        ax1, ay1, ax2, ay2 = c.bbox(self.pegs[a])
        while 1:
            x1, y1, x2, y2 = c.bbox(p)
            if y2 < ay1: break
            c.move(p, 0, -1)
            self.tk.update()

        # Move it towards peg b
        bx1, by1, bx2, by2 = c.bbox(self.pegs[b])
        newcenter = (bx1+bx2)//2
        while 1:
            x1, y1, x2, y2 = c.bbox(p)
            center = (x1+x2)//2
            if center == newcenter: break
            if center > newcenter: c.move(p, -1, 0)
            else: c.move(p, 1, 0)
            self.tk.update()

        # Move it down on top of the previous piece
        pieceheight = y2-y1
        newbottom = by2 - pieceheight*len(self.pegstate[b]) - 2
        while 1:
            x1, y1, x2, y2 = c.bbox(p)
            if y2 >= newbottom: break
            c.move(p, 0, 1)
            self.tk.update()

        # Update peg state
        self.pegstate[b].append(i)


# Main program
def main():
    import sys, string

    # First argument is number of pegs, default 4
    if sys.argv[1:]:
        n = string.atoi(sys.argv[1])
    else:
        n = 4

    # Second argument is bitmap file, default none
    if sys.argv[2:]:
        bitmap = sys.argv[2]
        # Reverse meaning of leading '@' compared to Tk
        if bitmap[0] == '@': bitmap = bitmap[1:]
        else: bitmap = '@' + bitmap
    else:
        bitmap = None

    # Create the graphical objects...
    h = Tkhanoi(n, bitmap)

    # ...and run!
    h.run()


# Call main when run as script
if __name__ == '__main__':
    main()
PK�
Q\Xj|0J|J|
guido/ss1.pyonu�[����
��^c@s�dZddlZddlZddlZddlZddlZddlmZdddf\ZZ	Z
d�Zd�Zd	�Z
iee6ee	6e
e
6Zid
e6de	6de
6Zied
6e	d6e
d6Zid
e6de	6de
6Zd�Zdfd��YZdfd��YZdfd��YZdefd��YZdefd��YZdefd��YZd�Zd�Zd�Zd�ZddlZd fd!��YZd"�Z d#�Z!e"d$kr�e!�ndS(%sSS1 -- a spreadsheet.i����N(texpattLEFTtCENTERtRIGHTcCs
|j|�S(N(tljust(txtn((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRscCs
|j|�S(N(tcenter(RR((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRscCs
|j|�S(N(trjust(RR((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRstleftRtrighttwtecCs4d}x'|D]}|dk	r
||7}q
q
W|S(Ni(tNone(tseqttotalR((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pytsums

tSheetcBs�eZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�ZRS(cCsOi|_tj�|_|jjd�}|j|_|j|_t|_dS(Nt__main__(tcellstrexectRExect
add_modulet	cellvaluetcelltmulticellvalueR(tselftm((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt__init__"s	cCs9|j||�}t|d�r1|j|j�S|SdS(Ntrecalc(tgetcellthasattrRR(RRtyR((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR*scCs�||kr||}}n||kr8||}}ng}xRt||d�D]=}x4t||d�D]}|j|j||��qlWqRW|S(Ni(trangetappendR(Rtx1ty1tx2ty2RR R((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR1s!cCs|jj||f�S(N(Rtget(RRR ((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR<scCs||j||f<dS(N(R(RRR R((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pytsetcell?scCs,y|j||f=Wntk
r'nXdS(N(RtKeyError(RRR ((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt	clearcellDs
cCs1x*|j||||�D]}|j|=qWdS(N(tselectcellsR(RR#R$R%R&txy((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt
clearcellsJscCs|jd|tj|�dS(Ni(R-tsystmaxint(RR$R&((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt	clearrowsNscCs|j|d|tj�dS(Ni(R-R.R/(RR#R%((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pytclearcolumnsQscCs�||kr||}}n||kr8||}}ng|jD]P\}}||koe|knrB||ko�|knrB||f^qBS(N(R(RR#R$R%R&RR ((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR+TscCs#|dkr|dkrdS||kr8||}}n||krT||}}ni}x�|jD]�\}}	|j||	f}
t|
d�r�|
j||||||�}
n||ko�|knr||	ko�|knr||7}|	|7}	n|
|||	f<qdW||_dS(Nitrenumber(RRR2(RR#R$R%R&tdxtdytnewRR R((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt	movecells\s !8

cCs&|jd|tjtjd|�dS(Ni(R6R.R/(RR R((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt
insertrowsoscCs^||kr||}}n|j||�|jd|dtjtjd||d�dS(Nii(R0R6R.R/(RR$R&((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt
deleterowssscCs&|j|dtjtj|d�dS(Ni(R6R.R/(RRR((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt
insertcolumnsyscCs^||kr||}}n|j||�|j|ddtjtj||dd�dS(Nii(R-R6R.R/(RR#R%((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt
deletecolumns}scCsLd}}x5|jD]*\}}t||�}t||�}qW||fS(Ni(Rtmax(RtmaxxtmaxyRR ((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pytgetsize�s

cCs:x3|jj�D]"}t|d�r|j�qqWdS(Ntreset(Rt
itervaluesRR?(RR((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR?�scCsJ|j�x9|jj�D](}t|d�r|j|j�qqWdS(NR(R?RR@RRR(RR((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR�s
cCs�|j�\}}|d|d}}dg|}i}xZtd|�D]I}t|�tf||df<\}}	t||t|��||<qJWxZtd|�D]I}
t|
�tf|d|
f<\}}	t|dt|��|d<q�Wx�|jj�D]�\\}}
}|dks|
dkr4qnt	|d�rV|j
|j�nt	|d�rz|j�\}}	n*t|�}t
|t�r�t}	nt}	||	f|||
f<t||t|��||<qWd}x9t|�D]+}|r|d7}n|d||7}q�Wx�t|�D]�}
d}
xot|�D]a}|j||
f�pgdtf\}}	t|	|||�}|
r�|
d7}
n|
|7}
qCW|
GH|
dkr*|GHq*q*WdS(	NiiRtformattt+t-t|(R>R!tcolnum2nameRR;tlentstrRt	iteritemsRRRRAt
isinstanceRR'talign2action(RR<R=twidththeighttcolwidthtfullRttextt	alignmentR Rtseptline((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pytdisplay�sP
&!&!"	!
'
cCs�dg}xn|jj�D]]\\}}}t|d�rI|j�}ndtj|�}|jd|||f�qW|jd�dj|�S(Ns
<spreadsheet>txmls<value>%s</value>s%<cell row="%s" col="%s">
  %s
</cell>s</spreadsheet>s
(RRIRRUtcgitescapeR"tjoin(RtoutRR Rtcellxml((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRU�s	"	
cCs\|j�}t|d�}|j|�|rN|jd�rN|jd�n|j�dS(NRs
(RUtopentwritetendswithtclose(RtfilenameRPtf((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pytsave�s
cCs0t|d�}t|�j|�|j�dS(Ntr(R[tSheetParsert	parsefileR^(RR_R`((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pytload�s(t__name__t
__module__RRRRR(R*R-R0R1R+R6R7R8R9R:R>R?RRTRURaRe(((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR s,																			2		RccBs�eZd�Zd�Zd�Zd�Zd�Zd�Zd�ZeZ	d�Z
d�Zd	�Zd
�Z
d�Zd�Zd
�Zd�ZRS(cCs
||_dS(N(tsheet(RRh((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR�scCsAtj�}|j|_|j|_|j|_|j|�dS(N(	RtParserCreatetstartelementtStartElementHandlert
endelementtEndElementHandlertdatatCharacterDataHandlert	ParseFile(RR`tparser((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRd�s
cCsct|d|d�}|rVx*|j�D]\}}t|�||<q)W||�ng|_dS(Ntstart_(tgetattrR
RIRHttexts(Rttagtattrstmethodtkeytvalue((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRj�s
cCs t|�}|jj|�dS(N(RHRtR"(RRP((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRn�scCs9t|d|d�}|r5|dj|j��ndS(Ntend_RB(RsR
RXRt(RRuRw((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRl�scCs4t|jd��|_t|jd��|_dS(Ntrowtcol(tintR'R R(RRv((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt
start_cell�scCs1|jd�|_tj|jd��|_dS(NRAtalign(R'tfmtt	xml2alignRQ(RRv((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pytstart_valuescCs*yt|�|_Wnd|_nXdS(N(R}RyR
(RRP((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pytend_intscCs*yt|�|_Wnd|_nXdS(N(tlongRyR
(RRP((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pytend_long
scCs*yt|�|_Wnd|_nXdS(N(tfloatRyR
(RRP((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt
end_doublescCs*yt|�|_Wnd|_nXdS(N(tcomplexRyR
(RRP((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pytend_complexscCs$y
||_Wnd|_nXdS(N(RyR
(RRP((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt
end_strings
cCs�t|jt�r!|j|_nit|jt�r`t|j|jpHd|jpTt�|_n*t	|j|jpud|jp�t
�|_dS(Ns%s(RJRytBaseCellRRHt
StringCellR�RQRtNumericCellR(RRP((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt	end_value%s		cCs+t||jpd|jpt�|_dS(Ns%s(tFormulaCellR�RQRR(RRP((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pytend_formula1scCs#|jj|j|j|j�dS(N(RhR(RR R(RRP((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pytend_cell6s(RfRgRRdRjRnRlR~R�t
start_formulaR�R�R�R�R�R�R�R�(((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRc�s 														R�cBseZdZRS(N(RfRgR
R(((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR�9s	R�cBsVeZded�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
RS(	s%scCs||_||_||_dS(N(RyR�RQ(RRyR�RQ((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRGs		cCs|jS(N(Ry(RR((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRNscCs:y|j|j}Wnt|j�}nX||jfS(N(R�RyRHRQ(RRP((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRAQs
cCs=t|dt|j�j�}dt|j|j|�fS(Nt_xml_s(<value align="%s" format="%s">%s</value>(RsttypeRyRft	align2xmlRQR�(RRw((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRUXs

cCs8d|jkodknr*d|jS|j�SdS(Niis
<int>%s</int>I�i�I�(Ryt	_xml_long(R((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt_xml_int_scCsd|jS(Ns<long>%s</long>(Ry(R((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR�escCsdt|j�S(Ns<double>%s</double>(treprRy(R((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt
_xml_floathscCsdt|j�S(Ns<complex>%s</double>(R�Ry(R((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt_xml_complexks(RfRgRRRRARUR�R�R�R�(((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR�Es						R�cBs2eZded�Zd�Zd�Zd�ZRS(s%scCs||_||_||_dS(N(RPR�RQ(RRPR�RQ((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRps		cCs|jS(N(RP(RR((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRwscCs|j|jfS(N(RPRQ(R((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRAzscCs-d}|t|j|jtj|j�fS(Ns9<value align="%s" format="%s"><string>%s</string></value>(R�RQR�RVRWRP(Rts((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRU}s

(RfRgRRRRARU(((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR�ns		R�cBsDeZded�Zd�Zd�Zd�Zd�Zd�ZRS(s%scCs;||_t|j�|_||_||_|j�dS(N(tformulat	translatet
translatedR�RQR?(RR�R�RQ((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR�s
			cCs
d|_dS(N(R
Ry(R((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR?�scCs�|jdkr�y4|jddt|j��|jd�|_Wq�tj�d}t|d�rw|j	|_q�t
|�|_q�Xn|jS(Ns from __future__ import division
s__value__ = eval(%s)t	__value__iRf(RyR
tr_execR�R�tr_evalR.texc_infoRRfRH(RRtexc((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR�s	cCs:y|j|j}Wnt|j�}nX||jfS(N(R�RyRHRQ(RRP((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRA�s
cCsdt|j|j|jfS(Ns,<formula align="%s" format="%s">%s</formula>(R�RQR�R�(R((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRU�s
cCs�g}x�tjd|j�D]�}tjd|�}	|	dk	r�|	j�\}
}t|
�}t|�}
||ko�|knr�||
ko�|knr�t|||
|�}q�n|j	|�qWt
dj|�|j|j
�S(Ns(\w+)s^([A-Z]+)([1-9][0-9]*)$RB(tretsplitR�tmatchR
tgroupstcolname2numR}tcellnameR"R�RXR�RQ(RR#R$R%R&R3R4RYtpartRtsxtsyRR ((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR2�s8(	RfRgRRR?RRARUR2(((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR��s				c	Cs�g}x�tjd|�D]�}tjd|�}|dkrM|j|�q|j�\}}}}t|�}|dkr�d||f}n"t|�}d||||f}|j|�qWdj|�S(s�Translate a formula containing fancy cell names to valid Python code.

    Examples:
        B4 -> cell(2, 4)
        B4:Z100 -> cells(2, 4, 26, 100)
    s(\w+(?::\w+)?)s2^([A-Z]+)([1-9][0-9]*)(?::([A-Z]+)([1-9][0-9]*))?$scell(%s, %s)scells(%s, %s, %s, %s)RBN(R�R�R�R
R"R�R�RX(	R�RYR�RR#R$R%R&R�((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR��scCst|�t|�S(sETranslate a cell coordinate to a fancy cell name (e.g. (1, 1)->'A1').(RFRH(RR ((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR��scCsI|j�}d}x0|D](}|dt|�td�d}qW|S(sCTranslate a column name to number (e.g. 'A'->1, 'Z'->26, 'AA'->27).iitAi(tuppertord(R�Rtc((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR��s

&cCsJd}x=|rEt|dd�\}}t|td��|}q	W|S(s6Translate a column number to name (e.g. 1->'A', etc.).RBiiR�(tdivmodtchrR�(RR�R((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRF�s
	tSheetGUIcBs�eZdZdddd�Zd�Zd�Zd�Zd�Zd	�Zd
�Z	d�Z
d�Zd
�Zd�Z
d�ZeZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�ZRS(s7Beginnings of a GUI for a spreadsheet.

    TO DO:
    - clear multiple cells
    - Insert, clear, remove rows or columns
    - Show new contents while typing
    - Scroll bars
    - Grow grid when window is grown
    - Proper menus
    - Undo, redo
    - Cut, copy and paste
    - Formatting and alignment
    s
sheet1.xmli
icCs*||_t�|_tjj|�r:|jj|�n|jj�\}}t||�}t||�}t	j	�|_
|j
jd|j�t	j|j
dddd�|_
t	j|j
�|_t	j|j
ddd	|j�|_t	j|j
�|_|jjd
ddd
dd�|j
jd
d�|jjd
d�|jjd
ddd
dd�|jjd|j�|jjd|j�|jjd|j�|jjd|j�|jjd|j�|jjd|j�|j||�d|_d|_ |j!d
d
�|j"�dS(slConstructor.

        Load the sheet from the filename argument.
        Set up the Tk widget tree.
        sSpreadsheet: %sRPtA1tfontt	helveticaitboldtSavetcommandtsidetbottomtexpanditfilltbothR	R
Rs<Return>s<Shift-Return>s<Tab>s<Shift-Tab>s<Delete>s<Escape>N(R�iR�(#R_RRhtostpathtisfileReR>R;tTktroottwm_titletLabeltbeacontEntrytentrytButtonRat
savebuttontFrametcellgridtpacktbindtreturn_eventtshift_return_eventt	tab_eventtshift_tab_eventtdelete_eventtescape_eventtmakegridR
t	currentxytcornerxyt
setcurrenttsync(RR_trowstcolumnsR<R=((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR�s<			cCsr|j|jkr>|jdk	r>|jj|j|j�n|jj|j�|j�|jjdd�dS(Nitendtbreak(	R�R�R
RhR-R*R�R�tdelete(Rtevent((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR�'s!
cCs#|j\}}|j||�dS(N(R�t
load_entry(RR�RR ((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR�0scCs�|jj||�}|dkr*d}n1t|t�rId|j}n|j�\}}|jjdd�|jj	d|�|jj
dd�dS(NRBt=iR�(RhRR
RJR�R�RAR�R�tinserttselection_range(RRR RRPRQ((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR�4s	c
Cs||_||_i|_tj|jdd�}|jdddddd�|jd|j�x�t	d	|d	�D]�}|jj
|d
d�tj|jdt|�dd�}|jd|dddd
�||j|df<||_d|_
|jd|j�|jd|j�|jd|j�|jd|j�qvWx�t	d	|d	�D]�}tj|jdt|�dd�}|jddd|dd
�||jd|f<d|_||_
|jd|j�|jd|j�|jd|j�|jd|j�q[Wx�t	d	|d	�D]�}x�t	d	|d	�D]�}tj|jdddddd�}|jd|d|dd�||j||f<||_||_
|jd|j�|jd|j�|jd|j�|jd|j�qDWq*WdS(s�Helper to create the grid of GUI cells.

        The edge (x==0 or y==0) is filled with labels; the rest is real cells.
        trelieftraisedtcolumniR{tstickytNSWEs<ButtonPress-1>itminsizei@RPtWEs<B1-Motion>s<ButtonRelease-1>s<Shift-Button-1>tsunkentbgtwhitetfgtblackN(R�R�t	gridcellsR�R�R�tgrid_configureR�t	selectallR!tgrid_columnconfigureRFt_SheetGUI__xt_SheetGUI__ytselectcolumntextendcolumnRHt	selectrowt	extendrowtpresstmotiontrelease(RR�R�RRR ((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR�@sN			$		$				cCs*|jdd�|jtjtj�dS(Ni(R�t	setcornerR.R/(RR�((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR�rscCs<|j|�\}}|j|d�|j|tj�dS(Ni(twhichxyR�R�R.R/(RR�RR ((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR�vscCsR|j|�\}}|dkrN|j|jdd�|j|tj�ndS(Nii(R�R�R�R�R.R/(RR�RR ((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR�{scCs<|j|�\}}|jd|�|jtj|�dS(Ni(R�R�R�R.R/(RR�RR ((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR��scCsR|j|�\}}|dkrN|jd|jd�|jtj|�ndS(Nii(R�R�R�R�R.R/(RR�RR ((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR��scCsD|j|�\}}|dkr@|dkr@|j||�ndS(Ni(R�R�(RR�RR ((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR��scCsD|j|�\}}|dkr@|dkr@|j||�ndS(Ni(R�R�(RR�RR ((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR��scCsh|jj|j|j�}|dk	rdt|tj�rdy|j|j	fSWqdt
k
r`qdXndS(Ni(ii(R�twinfo_containingtx_rootty_rootR
RJR�R�R�R�tAttributeError(RR�R((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR��s
cCs|jj|j�dS(N(RhRaR_(R((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRa�scCs�|jdk	r|j�n|j�t||�|jd<|j||�|jj�||f|_d|_	|j
j|j�}|dk	r�d|d<ndS(sMake (x, y) the current cell.RPtyellowR�N(R�R
tchange_cellt
clearfocusR�R�R�R�t	focus_setR�R�R'(RRR tgridcell((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR��s


	c	Csc|jdks$|j||fkr8|j||�dS|j�||f|_|j\}}|jpo|j\}}||kr�||}}n||kr�||}}nxh|jj�D]W\\}}}||ko�|knr�||ko|knr�d|d<q�q�W|jj|j�}|dk	rId|d<n|j||||�dS(Nt	lightBlueR�R(	R�R
R�RR�R�RIR't	setbeacon(	RRR R#R$R%R&RR((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR��s$$
"8
cCs#||kodknrD||ko6tjknrDd}n�||fdtjfkr�||krxd|}qd||f}n�||fdtjfkr�||kr�dt|�}qdt|�t|�f}n.t|j�}t|j�}d||f}||jd<dS(Nit:s%ds%d:%ds%ss%s:%sRP(R.R/RFR�R�R�R�(RR#R$R%R&tnametname1tname2((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR	�s;	
cCs�|jdk	r�|j\}}|jp-|j\}}||krR||}}n||krn||}}nxk|jj�D]W\\}}}||ko�|knr~||ko�|knr~d|d<q~q~WndS(NR�R�(R�R
R�R�RI(RR#R$R%R&RR R((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR�s"8cCs1|j�|j\}}|j||d�dS(sCallback for the Return key.iR�(RR�R�(RR�RR ((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR��s
cCs:|j�|j\}}|j|td|d��dS(s0Callback for the Return key with Shift modifier.iR�(RR�R�R;(RR�RR ((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR��s
cCs1|j�|j\}}|j|d|�dS(sCallback for the Tab key.iR�(RR�R�(RR�RR ((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR��s
cCs:|j�|j\}}|jtd|d�|�dS(s-Callback for the Tab key with Shift modifier.iR�(RR�R�R;(RR�RR ((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR��s
cCs�|j\}}|jj�}d}|jd�rFt|d�}nGxDtttt	fD]0}y||�}Wn
qYqYXt
|�}PqYW|dkr�|r�t|�}n|dkr�|jj
||�n|jj|||�|j�dS(s+Set the current cell from the entry widget.R�iN(R�R�R'R
t
startswithR�R}R�R�R�R�R�RhR*R(R�(RRR RPRtclsRy((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRs$cCs�|jj�x�|jj�D]�\\}}}|dks|dkrMqn|jj||�}|dkr{d|d<qt|d�r�|j�\}}nt|�t	}}||d<t
||d<qWdS(s(Fill the GUI cells from the sheet cells.iRBRPRAtanchorN(RhRR�RIRR
RRARHRtalign2anchor(RRR RRRPRQ((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR�s
"

(RfRgt__doc__RR�R�R�R�R�R�R�R�R�R�R�R�R�RaR�R�R	RR�R�R�R�RR�(((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR��s4-					2																			cCs�ddl}t�}x�tdd�D]�}x�tdd�D]�}|dkr\t|�}nU|dkrwt|�}n:t|d�}td|�}d||f}t|�}|j|||�q;Wq%W|j�|jd�dS(sBasic non-gui self-test.i����Niis%s*%ss
sheet1.xml(	R�RR!R�R�R�R(RTRa(R�taRR Rtc1tc2R�((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt
test_basic,s	
cCs@tjdrtjd}nd}t|�}|jj�dS(s	GUI test.is
sheet1.xmlN(R.targvR�R�tmainloop(R_tg((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyttest_guiBs

R(#RR�R�R.RVRtxml.parsersRRRRRRRRKR�R�RRRRcR�R�R�R�R�R�R�RFtTkinterR�R�RRRf(((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt<module>s@				�Y)6						�C			PK�
Q\M�dUUguido/MimeViewer.pycnu�[����
Afc@soddlZddlTddlTddlmZdd	d��YZd�Zd�Zedkrke�ndS(
i����N(t*(tScrolledTextt
MimeViewercBsGeZd�Zd�Zd�Zd�Zd�Zd�Zd�ZRS(c	Cs�||_||_t|idd6dd6�|_idd6dd6|j_t|ji|d	6|jd
6�|_|jjidd6�|j	d
��}t
|d�}|r"t|ji|d6dd6dd6dd6dd6�|_idd6dd6|jd6|j_|jj
d|�nNt|jidd6dd6�|_idd6dd6dd6|jd6|j_|j�}t|�tkr)d|_t
|d�}|rt|ji|d6dd6dd6dd6dd6�|_idd6dd6|j_|jj
d|�n	d|_d|_n�t|jidd6dd6�|_idd6dd6dd6|jd6|j_g|_xQtt|��D]=}t|jd ||df||�}|jj|�q�Wd|_d|_dS(!NtraisedtreliefitbditexpandtbothtfillttexttcommandtwtanchorcSs|dko|d dkS(Ntreceivedisx400-((tx((s5/usr/lib64/python2.7/Demo/tkinter/guido/MimeViewer.pyt<lambda>titheightiPtwidthtnonetwrapitaftertendttoptsidetipadyRi
tflattlefttipadxtys%s.%d(ttitletmsgtFrametframetpackingtCheckbuttonttoggletbuttontpackt
getheadertextt
countlinesRthtexttinserttgetbodyttypet
StringTypetNonetpadtbtexttpartstrangetlenRtappendt	collapsed(	tselftparentRRt
headertextRtbodytitp((s5/usr/lib64/python2.7/Demo/tkinter/guido/MimeViewer.pyt__init__sn		 	
	
	
		

				
	cCs|jj|jj�dS(N(R!R&R"(R6((s5/usr/lib64/python2.7/Demo/tkinter/guido/MimeViewer.pyR&GscCs|jj�dS(N(R!tdestroy(R6((s5/usr/lib64/python2.7/Demo/tkinter/guido/MimeViewer.pyR=IscCs|jr|jj�ndS(N(R5R%tinvoke(R6((s5/usr/lib64/python2.7/Demo/tkinter/guido/MimeViewer.pytshowKs	cCs$|jr|j�n
|j�dS(N(R5texplodetcollapse(R6((s5/usr/lib64/python2.7/Demo/tkinter/guido/MimeViewer.pyR$Ns	
cCs�d|_x3|j|j|jfD]}|r"|j�q"q"W|jrlx!|jD]}|jj�qRWn|jjidd6�dS(NiiR(R5R)R0R/tforgetR1R!R&(R6tcomptpart((s5/usr/lib64/python2.7/Demo/tkinter/guido/MimeViewer.pyRASs		cCs�d|_x9|j|j|jfD]}|r"|j|j�q"q"W|jrox|jD]}|j�qXWn|jjidd6�dS(NiiR(R5R)R0R/R&R"R1R!(R6RCRD((s5/usr/lib64/python2.7/Demo/tkinter/guido/MimeViewer.pyR@\s		(	t__name__t
__module__R<R&R=R?R$RAR@(((s5/usr/lib64/python2.7/Demo/tkinter/guido/MimeViewer.pyRs	;						cCs\d}d}xI||krWtj|d|�}|dkr@Pn|d}|d}qW|S(Nis
i(tstringtfind(tstrtlimitR:tn((s5/usr/lib64/python2.7/Demo/tkinter/guido/MimeViewer.pyR(es
cCsBddl}ddl}ddl}|j|jdd�\}}x|D]\}}qJWd}d}x:|D]2}	|	d dkr�|	d}qmtj|	�}qmW|j�}
|
j|�}|s�|j	�}n|j
|�}t�}
|
j}t
|
d||f|�}|j�|j�|
jdd�|j�dS(Ni����iRtinboxt+s+%s/%d(tsystgetopttmhlibtargvR.RGtatoitMHt
openfoldert
getcurrenttopenmessagetTkttkRR&R?tminsizetmainloop(RNRORPtoptstargstotatmessagetfoldertargtmhtftmtrootRXR((s5/usr/lib64/python2.7/Demo/tkinter/guido/MimeViewer.pytmainos0

		

t__main__((RGttypestTkinterRRR(RfRE(((s5/usr/lib64/python2.7/Demo/tkinter/guido/MimeViewer.pyt<module>s

Z	
	 PK�
Q\k>'��guido/hello.pycnu�[����
��^c@s3ddlZddlTd�Zd�Ze�dS(i����N(t*cCsAt�}t|�}d|d<t|d<|j�|j�dS(NsHello, worldttexttcommand(tTktButtont
quit_callbacktpacktmainloop(troottbutton((s0/usr/lib64/python2.7/Demo/tkinter/guido/hello.pytmains	


cCstjd�dS(Ni(tsystexit(((s0/usr/lib64/python2.7/Demo/tkinter/guido/hello.pyRs(RtTkinterR
R(((s0/usr/lib64/python2.7/Demo/tkinter/guido/hello.pyt<module>s
		PK�
Q\�X�\guido/ManPage.pyonu�[����
��^c@s�ddlZddlTddlmZddlmZdZdZejd�Zejd�Zejd	�Z	d
efd��YZ
de
fd
��YZeZd�Z
edkr�e
�ndS(i����N(t*(t_tkinter(tScrolledTexts*-Courier-Bold-R-Normal-*-120-*s!*-Courier-Medium-O-Normal-*-120-*s:^     Page [1-9][0-9]*[ 	]+\|^.*Last change:.*[1-9][0-9]*
s^[ 	]*
s^[ 	]*[Xv!_][Xv!_ 	]*
tEditableManPagecBsneZdd�Zd�Zd�Zd�ZeZd�Zd�Z	d�Z
d�Zd�Zd	d
�Z
RS(cKshttj||f|�|jddd�|jddt�|jddt�d|_d|_dS(NtXt	underlineit!tfontt_i(	tapplyRt__init__t
tag_configtBOLDFONTt
ITALICFONTtNonetfptlineno(tselftmastertcnf((s2/usr/lib64/python2.7/Demo/tkinter/guido/ManPage.pyR
s	cCs
|jdkS(N(RR(R((s2/usr/lib64/python2.7/Demo/tkinter/guido/ManPage.pytbusy%scCs|j�r|j�ndS(N(Rt
_endparser(R((s2/usr/lib64/python2.7/Demo/tkinter/guido/ManPage.pytkill)scCs-|j|�|jj|tj|j�dS(N(t_startparserttktcreatefilehandlerRtREADABLEt_filehandler(RR((s2/usr/lib64/python2.7/Demo/tkinter/guido/ManPage.pytasyncparsefile.s
cCs4|jj�}|s#|j�dS|j|�dS(N(RtreadlineRt
_parseline(RRtmasktnextline((s2/usr/lib64/python2.7/Demo/tkinter/guido/ManPage.pyR6s

cCszddlm}|d|d�}|j|d�}|j|�x'|j�}|s[Pn|j|�qEW|j�dS(Ni����(tselectgcSs||ggg|�dS(Ni((RttoutR!((s2/usr/lib64/python2.7/Demo/tkinter/guido/ManPage.pytavail@stheight(R!tgetintRRRR(RRR!R#R$R ((s2/usr/lib64/python2.7/Demo/tkinter/guido/ManPage.pyt
syncparsefile>s
cCs�|j�rtd�n|j�||_d|_d|_d|_d|_|d}t	|d<|j
dt�||d<dS(Nsstartparser: still busyitstates1.0(RtRuntimeErrortfilenoRRtoktemptyRtbuffertNORMALtdeletetEND(RRt	savestate((s2/usr/lib64/python2.7/Demo/tkinter/guido/ManPage.pyRLs
					

cCs�|j�std�n|jr1|jd�ny|jj|j�Wntk
r]}nX|jj�d|_|`
|`|`dS(Nsendparser: not busyt(RR(R,RRtdeletefilehandlerRtTclErrortcloseRR*R+(Rtmsg((s2/usr/lib64/python2.7/Demo/tkinter/guido/ManPage.pyR[s	
	cCs|js||_dStj|j�dkrDd|_||_dS|j}tj|�dkrt|}d|_nd}||_|js�d|_d|_dStj|�dkr�d|_d|_dS|d}t|d<t	dkr|j
dd�n|j
dt�|jrB|jd�|j
d|_
d|_n|sX|j|�n�d}d}xrttt|�t|���D]O}|||kr�||kr�|j|||!|�|}n||}q�q�W|j||�|j
d|_
||d<dS(	NiiR'g@tinsertsend-1cs
R1(R,t	emptyprogtmatchR+tulprogRR*t
footerprogR-t	TkVersiontmark_setR/t_insert_propRtrangetmintlen(RR ttextlinetproplineR0tptjti((s2/usr/lib64/python2.7/Demo/tkinter/guido/ManPage.pyRisV											

	
(	t cCs�|jt��}|jt�|�tdkrj|j|�}x'|D]}|j||t��qGWn|dkr�|j||t��ndS(Ng@RF(tindextAtInsertR6R;t	tag_namest
tag_removettag_add(Rtstrtproptherettagsttag((s2/usr/lib64/python2.7/Demo/tkinter/guido/ManPage.pyR=�s
N(t__name__t
__module__RR
RRRt	parsefileRR&RRRR=(((s2/usr/lib64/python2.7/Demo/tkinter/guido/ManPage.pyRs								<tReadonlyManPagecBseZdd�ZRS(cKs't|d<ttj||f|�dS(NR'(tDISABLEDR	RR
(RRR((s2/usr/lib64/python2.7/Demo/tkinter/guido/ManPage.pyR
�s
N(RQRRRR
(((s2/usr/lib64/python2.7/Demo/tkinter/guido/ManPage.pyRT�sc	CsNddl}ddl}d}d}d}|jdr]|jddkr]d}|jd=n|jdrz|jd}n|}|s�|dd!dkr�|d	}n|jj||�}nt�}|jdd�t|d
tdd�}|j	d
ddt
�|rt|d�}n|jd|d�}|j
|�|j�dS(Ni����s/usr/local/man/manntTcliis-fi����t.s.ntrelieftborderwidthitexpandtfilltrsnroff -man %s | ul -i(tostsystargvtpathtjointTktminsizetManPagetSUNKENtpacktBOTHtopentpopenRStmainloop(	R]R^tMANDIRtDEFAULTPAGEt	formattedtnametroottmanpageR((s2/usr/lib64/python2.7/Demo/tkinter/guido/ManPage.pyttest�s0 


	
t__main__(tretTkinterRRRR
tcompileR:R7R9RRTRdRqRQ(((s2/usr/lib64/python2.7/Demo/tkinter/guido/ManPage.pyt<module>s
	�	PK�
Q\M�dUUguido/MimeViewer.pyonu�[����
Afc@soddlZddlTddlTddlmZdd	d��YZd�Zd�Zedkrke�ndS(
i����N(t*(tScrolledTextt
MimeViewercBsGeZd�Zd�Zd�Zd�Zd�Zd�Zd�ZRS(c	Cs�||_||_t|idd6dd6�|_idd6dd6|j_t|ji|d	6|jd
6�|_|jjidd6�|j	d
��}t
|d�}|r"t|ji|d6dd6dd6dd6dd6�|_idd6dd6|jd6|j_|jj
d|�nNt|jidd6dd6�|_idd6dd6dd6|jd6|j_|j�}t|�tkr)d|_t
|d�}|rt|ji|d6dd6dd6dd6dd6�|_idd6dd6|j_|jj
d|�n	d|_d|_n�t|jidd6dd6�|_idd6dd6dd6|jd6|j_g|_xQtt|��D]=}t|jd ||df||�}|jj|�q�Wd|_d|_dS(!NtraisedtreliefitbditexpandtbothtfillttexttcommandtwtanchorcSs|dko|d dkS(Ntreceivedisx400-((tx((s5/usr/lib64/python2.7/Demo/tkinter/guido/MimeViewer.pyt<lambda>titheightiPtwidthtnonetwrapitaftertendttoptsidetipadyRi
tflattlefttipadxtys%s.%d(ttitletmsgtFrametframetpackingtCheckbuttonttoggletbuttontpackt
getheadertextt
countlinesRthtexttinserttgetbodyttypet
StringTypetNonetpadtbtexttpartstrangetlenRtappendt	collapsed(	tselftparentRRt
headertextRtbodytitp((s5/usr/lib64/python2.7/Demo/tkinter/guido/MimeViewer.pyt__init__sn		 	
	
	
		

				
	cCs|jj|jj�dS(N(R!R&R"(R6((s5/usr/lib64/python2.7/Demo/tkinter/guido/MimeViewer.pyR&GscCs|jj�dS(N(R!tdestroy(R6((s5/usr/lib64/python2.7/Demo/tkinter/guido/MimeViewer.pyR=IscCs|jr|jj�ndS(N(R5R%tinvoke(R6((s5/usr/lib64/python2.7/Demo/tkinter/guido/MimeViewer.pytshowKs	cCs$|jr|j�n
|j�dS(N(R5texplodetcollapse(R6((s5/usr/lib64/python2.7/Demo/tkinter/guido/MimeViewer.pyR$Ns	
cCs�d|_x3|j|j|jfD]}|r"|j�q"q"W|jrlx!|jD]}|jj�qRWn|jjidd6�dS(NiiR(R5R)R0R/tforgetR1R!R&(R6tcomptpart((s5/usr/lib64/python2.7/Demo/tkinter/guido/MimeViewer.pyRASs		cCs�d|_x9|j|j|jfD]}|r"|j|j�q"q"W|jrox|jD]}|j�qXWn|jjidd6�dS(NiiR(R5R)R0R/R&R"R1R!(R6RCRD((s5/usr/lib64/python2.7/Demo/tkinter/guido/MimeViewer.pyR@\s		(	t__name__t
__module__R<R&R=R?R$RAR@(((s5/usr/lib64/python2.7/Demo/tkinter/guido/MimeViewer.pyRs	;						cCs\d}d}xI||krWtj|d|�}|dkr@Pn|d}|d}qW|S(Nis
i(tstringtfind(tstrtlimitR:tn((s5/usr/lib64/python2.7/Demo/tkinter/guido/MimeViewer.pyR(es
cCsBddl}ddl}ddl}|j|jdd�\}}x|D]\}}qJWd}d}x:|D]2}	|	d dkr�|	d}qmtj|	�}qmW|j�}
|
j|�}|s�|j	�}n|j
|�}t�}
|
j}t
|
d||f|�}|j�|j�|
jdd�|j�dS(Ni����iRtinboxt+s+%s/%d(tsystgetopttmhlibtargvR.RGtatoitMHt
openfoldert
getcurrenttopenmessagetTkttkRR&R?tminsizetmainloop(RNRORPtoptstargstotatmessagetfoldertargtmhtftmtrootRXR((s5/usr/lib64/python2.7/Demo/tkinter/guido/MimeViewer.pytmainos0

		

t__main__((RGttypestTkinterRRR(RfRE(((s5/usr/lib64/python2.7/Demo/tkinter/guido/MimeViewer.pyt<module>s

Z	
	 PK�
Q\27O�::guido/imageview.pycnu�[����
��^c@s*ddlTddlZd�Ze�dS(i����(t*NcCsOtjd}t�}td|�}t|d|�}|j�|j�dS(Nitfiletimage(tsystargvtTkt
PhotoImagetLabeltpacktmainloop(tfilenametroottimgtlabel((s4/usr/lib64/python2.7/Demo/tkinter/guido/imageview.pytmains
	
(tTkinterRR(((s4/usr/lib64/python2.7/Demo/tkinter/guido/imageview.pyt<module>s
	PK�
Q\a�A���guido/newmenubardemo.pynuȯ��#! /usr/bin/python2.7

"""Play with the new Tk 8.0 toplevel menu option."""

from Tkinter import *

class App:

    def __init__(self, master):
        self.master = master

        self.menubar = Menu(self.master)

        self.filemenu = Menu(self.menubar)

        self.filemenu.add_command(label="New")
        self.filemenu.add_command(label="Open...")
        self.filemenu.add_command(label="Close")
        self.filemenu.add_separator()
        self.filemenu.add_command(label="Quit", command=self.master.quit)

        self.editmenu = Menu(self.menubar)

        self.editmenu.add_command(label="Cut")
        self.editmenu.add_command(label="Copy")
        self.editmenu.add_command(label="Paste")

        self.helpmenu = Menu(self.menubar, name='help')

        self.helpmenu.add_command(label="About...")

        self.menubar.add_cascade(label="File", menu=self.filemenu)
        self.menubar.add_cascade(label="Edit", menu=self.editmenu)
        self.menubar.add_cascade(label="Help", menu=self.helpmenu)

        self.top = Toplevel(menu=self.menubar)

        # Rest of app goes here...

def main():
    root = Tk()
    root.withdraw()
    app = App(root)
    root.mainloop()

if __name__ == '__main__':
    main()
PK�
Q\v����guido/canvasevents.pynuȯ��#! /usr/bin/python2.7

from Tkinter import *
from Canvas import Oval, Group, CanvasText


# Fix a bug in Canvas.Group as distributed in Python 1.4.  The
# distributed bind() method is broken.  This is what should be used:

class Group(Group):
    def bind(self, sequence=None, command=None):
        return self.canvas.tag_bind(self.id, sequence, command)

class Object:

    """Base class for composite graphical objects.

    Objects belong to a canvas, and can be moved around on the canvas.
    They also belong to at most one ``pile'' of objects, and can be
    transferred between piles (or removed from their pile).

    Objects have a canonical ``x, y'' position which is moved when the
    object is moved.  Where the object is relative to this position
    depends on the object; for simple objects, it may be their center.

    Objects have mouse sensitivity.  They can be clicked, dragged and
    double-clicked.  The behavior may actually be determined by the pile
    they are in.

    All instance attributes are public since the derived class may
    need them.

    """

    def __init__(self, canvas, x=0, y=0, fill='red', text='object'):
        self.canvas = canvas
        self.x = x
        self.y = y
        self.pile = None
        self.group = Group(self.canvas)
        self.createitems(fill, text)

    def __str__(self):
        return str(self.group)

    def createitems(self, fill, text):
        self.__oval = Oval(self.canvas,
                           self.x-20, self.y-10, self.x+20, self.y+10,
                           fill=fill, width=3)
        self.group.addtag_withtag(self.__oval)
        self.__text = CanvasText(self.canvas,
                           self.x, self.y, text=text)
        self.group.addtag_withtag(self.__text)

    def moveby(self, dx, dy):
        if dx == dy == 0:
            return
        self.group.move(dx, dy)
        self.x = self.x + dx
        self.y = self.y + dy

    def moveto(self, x, y):
        self.moveby(x - self.x, y - self.y)

    def transfer(self, pile):
        if self.pile:
            self.pile.delete(self)
            self.pile = None
        self.pile = pile
        if self.pile:
            self.pile.add(self)

    def tkraise(self):
        self.group.tkraise()


class Bottom(Object):

    """An object to serve as the bottom of a pile."""

    def createitems(self, *args):
        self.__oval = Oval(self.canvas,
                           self.x-20, self.y-10, self.x+20, self.y+10,
                           fill='gray', outline='')
        self.group.addtag_withtag(self.__oval)


class Pile:

    """A group of graphical objects."""

    def __init__(self, canvas, x, y, tag=None):
        self.canvas = canvas
        self.x = x
        self.y = y
        self.objects = []
        self.bottom = Bottom(self.canvas, self.x, self.y)
        self.group = Group(self.canvas, tag=tag)
        self.group.addtag_withtag(self.bottom.group)
        self.bindhandlers()

    def bindhandlers(self):
        self.group.bind('<1>', self.clickhandler)
        self.group.bind('<Double-1>', self.doubleclickhandler)

    def add(self, object):
        self.objects.append(object)
        self.group.addtag_withtag(object.group)
        self.position(object)

    def delete(self, object):
        object.group.dtag(self.group)
        self.objects.remove(object)

    def position(self, object):
        object.tkraise()
        i = self.objects.index(object)
        object.moveto(self.x + i*4, self.y + i*8)

    def clickhandler(self, event):
        pass

    def doubleclickhandler(self, event):
        pass


class MovingPile(Pile):

    def bindhandlers(self):
        Pile.bindhandlers(self)
        self.group.bind('<B1-Motion>', self.motionhandler)
        self.group.bind('<ButtonRelease-1>', self.releasehandler)

    movethis = None

    def clickhandler(self, event):
        tags = self.canvas.gettags('current')
        for i in range(len(self.objects)):
            o = self.objects[i]
            if o.group.tag in tags:
                break
        else:
            self.movethis = None
            return
        self.movethis = self.objects[i:]
        for o in self.movethis:
            o.tkraise()
        self.lastx = event.x
        self.lasty = event.y

    doubleclickhandler = clickhandler

    def motionhandler(self, event):
        if not self.movethis:
            return
        dx = event.x - self.lastx
        dy = event.y - self.lasty
        self.lastx = event.x
        self.lasty = event.y
        for o in self.movethis:
            o.moveby(dx, dy)

    def releasehandler(self, event):
        objects = self.movethis
        if not objects:
            return
        self.movethis = None
        self.finishmove(objects)

    def finishmove(self, objects):
        for o in objects:
            self.position(o)


class Pile1(MovingPile):

    x = 50
    y = 50
    tag = 'p1'

    def __init__(self, demo):
        self.demo = demo
        MovingPile.__init__(self, self.demo.canvas, self.x, self.y, self.tag)

    def doubleclickhandler(self, event):
        try:
            o = self.objects[-1]
        except IndexError:
            return
        o.transfer(self.other())
        MovingPile.doubleclickhandler(self, event)

    def other(self):
        return self.demo.p2

    def finishmove(self, objects):
        o = objects[0]
        p = self.other()
        x, y = o.x, o.y
        if (x-p.x)**2 + (y-p.y)**2 < (x-self.x)**2 + (y-self.y)**2:
            for o in objects:
                o.transfer(p)
        else:
            MovingPile.finishmove(self, objects)

class Pile2(Pile1):

    x = 150
    y = 50
    tag = 'p2'

    def other(self):
        return self.demo.p1


class Demo:

    def __init__(self, master):
        self.master = master
        self.canvas = Canvas(master,
                             width=200, height=200,
                             background='yellow',
                             relief=SUNKEN, borderwidth=2)
        self.canvas.pack(expand=1, fill=BOTH)
        self.p1 = Pile1(self)
        self.p2 = Pile2(self)
        o1 = Object(self.canvas, fill='red', text='o1')
        o2 = Object(self.canvas, fill='green', text='o2')
        o3 = Object(self.canvas, fill='light blue', text='o3')
        o1.transfer(self.p1)
        o2.transfer(self.p1)
        o3.transfer(self.p2)


# Main function, run when invoked as a stand-alone Python program.

def main():
    root = Tk()
    demo = Demo(root)
    root.protocol('WM_DELETE_WINDOW', root.quit)
    root.mainloop()

if __name__ == '__main__':
    main()
PK�
Q\&Y���guido/listtree.pycnu�[����
��^c@sWddlZddlZddlTd�Zd�Zd�ZedkrSe�ndS(i����N(t*cCs?t|dd�}|jdddt�t||dd�|S(Ntnametlisttexpanditfillt.i(tListboxtpacktBOTHt	listnodes(tmastertappR((s3/usr/lib64/python2.7/Demo/tkinter/guido/listtree.pytlisttreescCs�|j|dd|�}|jtd||f�|jj|j|dd|��}x%|D]}t||||d�q]WdS(Ntwinfotclasss%s (%s)tchildreni(tsendtinserttENDttkt	splitlistR	(RRtwidgettleveltklassRtc((s3/usr/lib64/python2.7/Demo/tkinter/guido/listtree.pyR	s	
cCs�tjds-tjjd�tjd�ntjd}t�}|jdd�t|dd�}|jdddt	�t
||�}|j�dS(NisUsage: listtree appname
iRtfRR(tsystargvtstderrtwritetexittTktminsizetFrameRRRtmainloop(RRRR((s3/usr/lib64/python2.7/Demo/tkinter/guido/listtree.pytmains

	t__main__(RtstringtTkinterRR	R#t__name__(((s3/usr/lib64/python2.7/Demo/tkinter/guido/listtree.pyt<module>s
		
	PK�
Q\-�ɖ55
guido/mbox.pynuȯ��#! /usr/bin/python2.7

# Scan MH folder, display results in window

import os
import sys
import re
import getopt
import string
import mhlib

from Tkinter import *

from dialog import dialog

mailbox = os.environ['HOME'] + '/Mail'

def main():
    global root, tk, top, mid, bot
    global folderbox, foldermenu, scanbox, scanmenu, viewer
    global folder, seq
    global mh, mhf

    # Parse command line options

    folder = 'inbox'
    seq = 'all'
    try:
        opts, args = getopt.getopt(sys.argv[1:], '')
    except getopt.error, msg:
        print msg
        sys.exit(2)
    for arg in args:
        if arg[:1] == '+':
            folder = arg[1:]
        else:
            seq = arg

    # Initialize MH

    mh = mhlib.MH()
    mhf = mh.openfolder(folder)

    # Build widget hierarchy

    root = Tk()
    tk = root.tk

    top = Frame(root)
    top.pack({'expand': 1, 'fill': 'both'})

    # Build right part: folder list

    right = Frame(top)
    right.pack({'fill': 'y', 'side': 'right'})

    folderbar = Scrollbar(right, {'relief': 'sunken', 'bd': 2})
    folderbar.pack({'fill': 'y', 'side': 'right'})

    folderbox = Listbox(right, {'exportselection': 0})
    folderbox.pack({'expand': 1, 'fill': 'both', 'side': 'left'})

    foldermenu = Menu(root)
    foldermenu.add('command',
                   {'label': 'Open Folder',
                    'command': open_folder})
    foldermenu.add('separator')
    foldermenu.add('command',
                   {'label': 'Quit',
                    'command': 'exit'})
    foldermenu.bind('<ButtonRelease-3>', folder_unpost)

    folderbox['yscrollcommand'] = (folderbar, 'set')
    folderbar['command'] = (folderbox, 'yview')
    folderbox.bind('<Double-1>', open_folder, 1)
    folderbox.bind('<3>', folder_post)

    # Build left part: scan list

    left = Frame(top)
    left.pack({'expand': 1, 'fill': 'both', 'side': 'left'})

    scanbar = Scrollbar(left, {'relief': 'sunken', 'bd': 2})
    scanbar.pack({'fill': 'y', 'side': 'right'})

    scanbox = Listbox(left, {'font': 'fixed'})
    scanbox.pack({'expand': 1, 'fill': 'both', 'side': 'left'})

    scanmenu = Menu(root)
    scanmenu.add('command',
                 {'label': 'Open Message',
                  'command': open_message})
    scanmenu.add('command',
                 {'label': 'Remove Message',
                  'command': remove_message})
    scanmenu.add('command',
                 {'label': 'Refile Message',
                  'command': refile_message})
    scanmenu.add('separator')
    scanmenu.add('command',
                 {'label': 'Quit',
                  'command': 'exit'})
    scanmenu.bind('<ButtonRelease-3>', scan_unpost)

    scanbox['yscrollcommand'] = (scanbar, 'set')
    scanbar['command'] = (scanbox, 'yview')
    scanbox.bind('<Double-1>', open_message)
    scanbox.bind('<3>', scan_post)

    # Separator between middle and bottom part

    rule2 = Frame(root, {'bg': 'black'})
    rule2.pack({'fill': 'x'})

    # Build bottom part: current message

    bot = Frame(root)
    bot.pack({'expand': 1, 'fill': 'both'})
    #
    viewer = None

    # Window manager commands

    root.minsize(800, 1) # Make window resizable

    # Fill folderbox with text

    setfolders()

    # Fill scanbox with text

    rescan()

    # Enter mainloop

    root.mainloop()

def folder_post(e):
    x, y = e.x_root, e.y_root
    foldermenu.post(x - 10, y - 10)
    foldermenu.grab_set()

def folder_unpost(e):
    tk.call('update', 'idletasks')
    foldermenu.grab_release()
    foldermenu.unpost()
    foldermenu.invoke('active')

def scan_post(e):
    x, y = e.x_root, e.y_root
    scanmenu.post(x - 10, y - 10)
    scanmenu.grab_set()

def scan_unpost(e):
    tk.call('update', 'idletasks')
    scanmenu.grab_release()
    scanmenu.unpost()
    scanmenu.invoke('active')

scanparser = re.compile('^ *([0-9]+)')

def open_folder(e=None):
    global folder, mhf
    sel = folderbox.curselection()
    if len(sel) != 1:
        if len(sel) > 1:
            msg = "Please open one folder at a time"
        else:
            msg = "Please select a folder to open"
        dialog(root, "Can't Open Folder", msg, "", 0, "OK")
        return
    i = sel[0]
    folder = folderbox.get(i)
    mhf = mh.openfolder(folder)
    rescan()

def open_message(e=None):
    global viewer
    sel = scanbox.curselection()
    if len(sel) != 1:
        if len(sel) > 1:
            msg = "Please open one message at a time"
        else:
            msg = "Please select a message to open"
        dialog(root, "Can't Open Message", msg, "", 0, "OK")
        return
    cursor = scanbox['cursor']
    scanbox['cursor'] = 'watch'
    tk.call('update', 'idletasks')
    i = sel[0]
    line = scanbox.get(i)
    if scanparser.match(line) >= 0:
        num = string.atoi(scanparser.group(1))
        m = mhf.openmessage(num)
        if viewer: viewer.destroy()
        from MimeViewer import MimeViewer
        viewer = MimeViewer(bot, '+%s/%d' % (folder, num), m)
        viewer.pack()
        viewer.show()
    scanbox['cursor'] = cursor

def interestingheader(header):
    return header != 'received'

def remove_message(e=None):
    itop = scanbox.nearest(0)
    sel = scanbox.curselection()
    if not sel:
        dialog(root, "No Message To Remove",
               "Please select a message to remove", "", 0, "OK")
        return
    todo = []
    for i in sel:
        line = scanbox.get(i)
        if scanparser.match(line) >= 0:
            todo.append(string.atoi(scanparser.group(1)))
    mhf.removemessages(todo)
    rescan()
    fixfocus(min(todo), itop)

lastrefile = ''
tofolder = None
def refile_message(e=None):
    global lastrefile, tofolder
    itop = scanbox.nearest(0)
    sel = scanbox.curselection()
    if not sel:
        dialog(root, "No Message To Refile",
               "Please select a message to refile", "", 0, "OK")
        return
    foldersel = folderbox.curselection()
    if len(foldersel) != 1:
        if not foldersel:
            msg = "Please select a folder to refile to"
        else:
            msg = "Please select exactly one folder to refile to"
        dialog(root, "No Folder To Refile", msg, "", 0, "OK")
        return
    refileto = folderbox.get(foldersel[0])
    todo = []
    for i in sel:
        line = scanbox.get(i)
        if scanparser.match(line) >= 0:
            todo.append(string.atoi(scanparser.group(1)))
    if lastrefile != refileto or not tofolder:
        lastrefile = refileto
        tofolder = None
        tofolder = mh.openfolder(lastrefile)
    mhf.refilemessages(todo, tofolder)
    rescan()
    fixfocus(min(todo), itop)

def fixfocus(near, itop):
    n = scanbox.size()
    for i in range(n):
        line = scanbox.get(repr(i))
        if scanparser.match(line) >= 0:
            num = string.atoi(scanparser.group(1))
            if num >= near:
                break
    else:
        i = 'end'
    scanbox.select_from(i)
    scanbox.yview(itop)

def setfolders():
    folderbox.delete(0, 'end')
    for fn in mh.listallfolders():
        folderbox.insert('end', fn)

def rescan():
    global viewer
    if viewer:
        viewer.destroy()
        viewer = None
    scanbox.delete(0, 'end')
    for line in scanfolder(folder, seq):
        scanbox.insert('end', line)

def scanfolder(folder = 'inbox', sequence = 'all'):
    return map(
            lambda line: line[:-1],
            os.popen('scan +%s %s' % (folder, sequence), 'r').readlines())

main()
PK�
Q\/	Ŕccguido/brownian2.pynu�[���# Brownian motion -- an example of a NON multi-threaded Tkinter program ;)
# By Michele Simoniato, inspired by brownian.py

from Tkinter import *
import random
import sys

WIDTH = 400
HEIGHT = 300
SIGMA = 10
BUZZ = 2
RADIUS = 2
LAMBDA = 10
FILL = 'red'

stop = 0                                # Set when main loop exits
root = None                             # main window

def particle(canvas):                   # particle = iterator over the moves
    r = RADIUS
    x = random.gauss(WIDTH/2.0, SIGMA)
    y = random.gauss(HEIGHT/2.0, SIGMA)
    p = canvas.create_oval(x-r, y-r, x+r, y+r, fill=FILL)
    while not stop:
        dx = random.gauss(0, BUZZ)
        dy = random.gauss(0, BUZZ)
        try:
            canvas.move(p, dx, dy)
        except TclError:
            break
        else:
            yield None

def move(particle): # move the particle at random time
    particle.next()
    dt = random.expovariate(LAMBDA)
    root.after(int(dt*1000), move, particle)

def main():
    global root, stop
    root = Tk()
    canvas = Canvas(root, width=WIDTH, height=HEIGHT)
    canvas.pack(fill='both', expand=1)
    np = 30
    if sys.argv[1:]:
        np = int(sys.argv[1])
    for i in range(np):                  # start the dance
        move(particle(canvas))
    try:
        root.mainloop()
    finally:
        stop = 1

if __name__ == '__main__':
    main()
PK�
Q\	�7E� � guido/mbox.pyonu�[����
Afc@s)ddlZddlZddlZddlZddlZddlZddlTddlmZejddZ	d�Z
d�Zd�Zd	�Z
d
�Zejd�Zdd�Zdd
�Zd�Zdd�Zdadadd�Zd�Zd�Zd�Zddd�Ze
�dS(i����N(t*(tdialogtHOMEs/Mailc	Cs#daday#tjtjdd�\}}Wn(tjk
rY}|GHtjd�nXx1|D])}|d dkr�|daqa|aqaWtj�a	t	j
t�at�a
t
jatt
�atjidd6dd	6�tt�}|jid
d	6dd6�t|id
d6dd6�}|jid
d	6dd6�t|idd6�atjidd6dd	6dd6�tt
�atjdidd6td6�tjd�tjdidd6dd6�tjdt�|dftd<tdf|d<tjdtd�tjdt�tt�}|jidd6dd	6dd6�t|id
d6dd6�}|jid
d	6dd6�t|idd 6�atjidd6dd	6dd6�tt
�atjdid!d6td6�tjdid"d6td6�tjdid#d6t d6�tjd�tjdidd6dd6�tjdt!�|dftd<tdf|d<tjdt�tjdt"�tt
id$d%6�}|jid&d	6�tt
�a#t#jidd6dd	6�da%t
j&d'd�t'�t(�t
j)�dS((Ntinboxtallitit+texpandtbothtfilltytrighttsidetsunkentrelieftbditexportselectiontlefttcommandsOpen Foldertlabelt	separatortQuittexits<ButtonRelease-3>tsettyscrollcommandtyviews
<Double-1>s<3>tfixedtfontsOpen MessagesRemove MessagesRefile Messagetblacktbgtxi (*tfoldertseqtgetopttsystargvterrorRtmhlibtMHtmht
openfoldertmhftTktrootttktFramettoptpackt	ScrollbartListboxt	folderboxtMenut
foldermenutaddtopen_foldertbindt
folder_unposttfolder_posttscanboxtscanmenutopen_messagetremove_messagetrefile_messagetscan_unpostt	scan_posttbottNonetviewertminsizet
setfolderstrescantmainloop(	toptstargstmsgtargRt	folderbarRtscanbartrule2((s//usr/lib64/python2.7/Demo/tkinter/guido/mbox.pytmains�#


		"	

	
""	
	
	

	
cCs9|j|j}}tj|d|d�tj�dS(Ni
(tx_rootty_rootR4tposttgrab_set(teRR
((s//usr/lib64/python2.7/Demo/tkinter/guido/mbox.pyR9�scCs5tjdd�tj�tj�tjd�dS(Ntupdatet	idletaskstactive(R,tcallR4tgrab_releasetunposttinvoke(RT((s//usr/lib64/python2.7/Demo/tkinter/guido/mbox.pyR8�s

cCs9|j|j}}tj|d|d�tj�dS(Ni
(RPRQR;RRRS(RTRR
((s//usr/lib64/python2.7/Demo/tkinter/guido/mbox.pyR@�scCs5tjdd�tj�tj�tjd�dS(NRURVRW(R,RXR;RYRZR[(RT((s//usr/lib64/python2.7/Demo/tkinter/guido/mbox.pyR?�s

s^ *([0-9]+)cCs�tj�}t|�dkr\t|�dkr9d}nd}ttd|ddd�dS|d}tj|�atjt�a	t
�dS(Nis Please open one folder at a timesPlease select a folder to opensCan't Open FolderRitOK(R2tcurselectiontlenRR+tgetRR'R(R)RF(RTtselRJti((s//usr/lib64/python2.7/Demo/tkinter/guido/mbox.pyR6�s	
c	Cs9tj�}t|�dkr\t|�dkr9d}nd}ttd|ddd�dStd}d	td<tjd
d�|d}tj|�}tj	|�dkr+t
jtjd��}t
j|�}tr�tj�ndd
lm}|tdt|f|�atj�tj�n|td<dS(Nis!Please open one message at a timesPlease select a message to opensCan't Open MessageRiR\tcursortwatchRURVi����(t
MimeViewers+%s/%d(R:R]R^RR+R,RXR_t
scanparsertmatchtstringtatoitgroupR)topenmessageRCtdestroyRdRARR/tshow(	RTR`RJRbRatlinetnumtmRd((s//usr/lib64/python2.7/Demo/tkinter/guido/mbox.pyR<�s,	





cCs
|dkS(Ntreceived((theader((s//usr/lib64/python2.7/Demo/tkinter/guido/mbox.pytinterestingheader�scCs�tjd�}tj�}|s>ttddddd�dSg}xT|D]L}tj|�}tj|�dkrK|jt	j
tjd���qKqKWtj
|�t�tt|�|�dS(NisNo Message To Removes!Please select a message to removeRR\i(R:tnearestR]RR+R_ReRftappendRgRhRiR)tremovemessagesRFtfixfocustmin(RTtitopR`ttodoRaRm((s//usr/lib64/python2.7/Demo/tkinter/guido/mbox.pyR=�s	
&
Rc	Cs]tjd�}tj�}|s>ttddddd�dStj�}t|�dkr�|skd}nd}ttd	|ddd�dStj|d�}g}xT|D]L}tj|�}tj	|�dkr�|j
tjtj
d���q�q�Wt|kstr/|adatjt�antj|t�t�tt|�|�dS(
NisNo Message To Refiles!Please select a message to refileRR\is#Please select a folder to refile tos-Please select exactly one folder to refile tosNo Folder To Refile(R:RsR]RR+R2R^R_ReRfRtRgRhRit
lastrefilettofolderRBR'R(R)trefilemessagesRFRvRw(	RTRxR`t	folderselRJtrefiletoRyRaRm((s//usr/lib64/python2.7/Demo/tkinter/guido/mbox.pyR>�s4		
&cCs�tj�}xot|�D][}tjt|��}tj|�dkrtjtj	d��}||krtPqtqqWd}tj
|�tj|�dS(Niitend(R:tsizetrangeR_treprReRfRgRhRitselect_fromR(tnearRxtnRaRmRn((s//usr/lib64/python2.7/Demo/tkinter/guido/mbox.pyRv�s
cCs;tjdd�x$tj�D]}tjd|�qWdS(NiR(R2tdeleteR'tlistallfolderstinsert(tfn((s//usr/lib64/python2.7/Demo/tkinter/guido/mbox.pyRE
scCsWtrtj�dantjdd�x'ttt�D]}tjd|�q9WdS(NiR(	RCRkRBR:R�t
scanfolderRR R�(Rm((s//usr/lib64/python2.7/Demo/tkinter/guido/mbox.pyRFs
	RRcCs,td�tjd||fd�j��S(NcSs|d S(Ni����((Rm((s//usr/lib64/python2.7/Demo/tkinter/guido/mbox.pyt<lambda>Rsscan +%s %str(tmaptostpopent	readlines(Rtsequence((s//usr/lib64/python2.7/Demo/tkinter/guido/mbox.pyR�s(R�R"treR!RgR%tTkinterRtenvirontmailboxROR9R8R@R?tcompileReRBR6R<RrR=RzR{R>RvRERFR�(((s//usr/lib64/python2.7/Demo/tkinter/guido/mbox.pyt<module>s4
	x						
			PK�
Q\"��@@guido/kill.pycnu�[����
Afc@s�ddlTddlmZddlmZddlZddlZdefd��YZdefd��YZ	e
d	kr�e	dd
d�Zej
�jd�ej
�jd
d
�ej�ndS(i����(t*(tsplitfields(tsplitNt	BarButtoncBseZdd�ZRS(cKsOttj||f|�|jdt�t|dd�|_|j|d<dS(Ntsidetnametmenu(tapplyt
Menubuttont__init__tpacktLEFTtMenuR(tselftmastertcnf((s//usr/lib64/python2.7/Demo/tkinter/guido/kill.pyR	sN(t__name__t
__module__tNoneR	(((s//usr/lib64/python2.7/Demo/tkinter/guido/kill.pyR
stKillc
Bs_eZdddddddd gZd�Zd�Zd�Zd�Zd�Zd!d�Z	RS("tDefaulttitLongs-litUsers-uitJobss-jtSignals-stMemorys-mtVMs-vtHexs-XcCsI|j|jj�d}t|�|}tjd|�|j�dS(Niskill -9 (tformat_listtformattgetRtostsystemt	do_update(R
tselectedtctpid((s//usr/lib64/python2.7/Demo/tkinter/guido/kill.pytkillscCs�|j|jj�\}}}tjd|�}t|d�}|jj|d�|d=|jj	j�d}|jj
jdt��x$|D]}|jj
j
d|�q�W|jj
jt|��dS(Nsps -w s
i(RRRtcommandst	getoutputRtheadertsettframetvscrolltlisttdeletetAtEndtinserttyviewtint(R
RtoptiontcolumntsR-tytline((s//usr/lib64/python2.7/Demo/tkinter/guido/kill.pyR" s
cCs6|jjdt�|jj|jj|j��dS(Ni(twidgettselect_cleartENDt
select_settnearestR6(R
te((s//usr/lib64/python2.7/Demo/tkinter/guido/kill.pyt	do_motion+scCs|jjdt�dS(Ni(R8R9R:(R
R=((s//usr/lib64/python2.7/Demo/tkinter/guido/kill.pytdo_leave.scCs,|j|jj|jj|j���dS(N(R&R8RR<R6(R
R=((s//usr/lib64/python2.7/Demo/tkinter/guido/kill.pytdo_10sc
Ks
tj|||�|jdddt�t|dddtdd�|_|jjdt�t|jd	d
�|j_|jjj	j
ddd
|j�t|jd	d�|j_t
|�|_|jjd�xYtt|j��D]B}|jjj	jd|j|dd
|jd|jd|�q�W|jj|jj|jj�t|dtdd�|_|jjdddt�t|�|_t|jdtdtddd|j�|j_|jjjdt�t|jdt�|j_t |jdt!ddddd|jjj�|j_"|jj"j#|jjd
<|jjjdt$dt%�|jj"jdddt�t&|d	dd
|j�|_'|j'jdddt�|jj"j(d|j)�|jj"j(d|j*�|jj"j(d|j+�|j�dS(NtexpanditfillRtbartrelieftborderwidthittexttFiletlabeltQuittcommandtViewitvariabletvaluetanchorttextvariabletorienttselectbackgrounds#eed5b7tselectborderwidthtyscrollRtUpdates<Motion>s<Leave>s<1>(,tFrameR	R
tBOTHtRAISEDRCtXRtfileRtadd_commandtquittviewtIntVarRR*trangetlenRtadd_radiobuttonR"t
tk_menuBarR+t	StringVarR)tLabeltFLATtNWRHt	ScrollbartVERTICALR,tListboxtSUNKENR-R1tRIGHTtYtButtontupdatetbindR>R?R@(R
RRtnum((s//usr/lib64/python2.7/Demo/tkinter/guido/kill.pyR	2sP		(RRi(Rs-li(Rs-ui(Rs-ji(Rs-si(Rs-mi(Rs-vi(Rs-XiN(
RRRR&R"R>R?R@RR	(((s//usr/lib64/python2.7/Demo/tkinter/guido/kill.pyRs						t__main__REisTkinter Process Killeri(tTkintertstringRRR'R RRRURRRR&twinfo_toplevelttitletminsizetmainloop(((s//usr/lib64/python2.7/Demo/tkinter/guido/kill.pyt<module>s
MPK�
Q\�(�V��guido/ManPage.pynu�[���# Widget to display a man page

import re
from Tkinter import *
from Tkinter import _tkinter
from ScrolledText import ScrolledText

# XXX These fonts may have to be changed to match your system
BOLDFONT = '*-Courier-Bold-R-Normal-*-120-*'
ITALICFONT = '*-Courier-Medium-O-Normal-*-120-*'

# XXX Recognizing footers is system dependent
# (This one works for IRIX 5.2 and Solaris 2.2)
footerprog = re.compile(
        '^     Page [1-9][0-9]*[ \t]+\|^.*Last change:.*[1-9][0-9]*\n')
emptyprog = re.compile('^[ \t]*\n')
ulprog = re.compile('^[ \t]*[Xv!_][Xv!_ \t]*\n')

# Basic Man Page class -- does not disable editing
class EditableManPage(ScrolledText):

    # Initialize instance
    def __init__(self, master=None, **cnf):
        # Initialize base class
        apply(ScrolledText.__init__, (self, master), cnf)

        # Define tags for formatting styles
        self.tag_config('X', underline=1)
        self.tag_config('!', font=BOLDFONT)
        self.tag_config('_', font=ITALICFONT)

        # Set state to idle
        self.fp = None
        self.lineno = 0

    # Test whether we are busy parsing a file
    def busy(self):
        return self.fp != None

    # Ensure we're not busy
    def kill(self):
        if self.busy():
            self._endparser()

    # Parse a file, in the background
    def asyncparsefile(self, fp):
        self._startparser(fp)
        self.tk.createfilehandler(fp, _tkinter.READABLE,
                                  self._filehandler)

    parsefile = asyncparsefile      # Alias

    # I/O handler used by background parsing
    def _filehandler(self, fp, mask):
        nextline = self.fp.readline()
        if not nextline:
            self._endparser()
            return
        self._parseline(nextline)

    # Parse a file, now (cannot be aborted)
    def syncparsefile(self, fp):
        from select import select
        def avail(fp=fp, tout=0.0, select=select):
            return select([fp], [], [], tout)[0]
        height = self.getint(self['height'])
        self._startparser(fp)
        while 1:
            nextline = fp.readline()
            if not nextline:
                break
            self._parseline(nextline)
        self._endparser()

    # Initialize parsing from a particular file -- must not be busy
    def _startparser(self, fp):
        if self.busy():
            raise RuntimeError, 'startparser: still busy'
        fp.fileno()             # Test for file-ness
        self.fp = fp
        self.lineno = 0
        self.ok = 0
        self.empty = 0
        self.buffer = None
        savestate = self['state']
        self['state'] = NORMAL
        self.delete('1.0', END)
        self['state'] = savestate

    # End parsing -- must be busy, need not be at EOF
    def _endparser(self):
        if not self.busy():
            raise RuntimeError, 'endparser: not busy'
        if self.buffer:
            self._parseline('')
        try:
            self.tk.deletefilehandler(self.fp)
        except TclError, msg:
            pass
        self.fp.close()
        self.fp = None
        del self.ok, self.empty, self.buffer

    # Parse a single line
    def _parseline(self, nextline):
        if not self.buffer:
            # Save this line -- we need one line read-ahead
            self.buffer = nextline
            return
        if emptyprog.match(self.buffer) >= 0:
            # Buffered line was empty -- set a flag
            self.empty = 1
            self.buffer = nextline
            return
        textline = self.buffer
        if ulprog.match(nextline) >= 0:
            # Next line is properties for buffered line
            propline = nextline
            self.buffer = None
        else:
            # Next line is read-ahead
            propline = None
            self.buffer = nextline
        if not self.ok:
            # First non blank line after footer must be header
            # -- skip that too
            self.ok = 1
            self.empty = 0
            return
        if footerprog.match(textline) >= 0:
            # Footer -- start skipping until next non-blank line
            self.ok = 0
            self.empty = 0
            return
        savestate = self['state']
        self['state'] = NORMAL
        if TkVersion >= 4.0:
            self.mark_set('insert', 'end-1c')
        else:
            self.mark_set('insert', END)
        if self.empty:
            # One or more previous lines were empty
            # -- insert one blank line in the text
            self._insert_prop('\n')
            self.lineno = self.lineno + 1
            self.empty = 0
        if not propline:
            # No properties
            self._insert_prop(textline)
        else:
            # Search for properties
            p = ''
            j = 0
            for i in range(min(len(propline), len(textline))):
                if propline[i] != p:
                    if j < i:
                        self._insert_prop(textline[j:i], p)
                        j = i
                    p = propline[i]
            self._insert_prop(textline[j:])
        self.lineno = self.lineno + 1
        self['state'] = savestate

    # Insert a string at the end, with at most one property (tag)
    def _insert_prop(self, str, prop = ' '):
        here = self.index(AtInsert())
        self.insert(AtInsert(), str)
        if TkVersion <= 4.0:
            tags = self.tag_names(here)
            for tag in tags:
                self.tag_remove(tag, here, AtInsert())
        if prop != ' ':
            self.tag_add(prop, here, AtInsert())

# Readonly Man Page class -- disables editing, otherwise the same
class ReadonlyManPage(EditableManPage):

    # Initialize instance
    def __init__(self, master=None, **cnf):
        cnf['state'] = DISABLED
        apply(EditableManPage.__init__, (self, master), cnf)

# Alias
ManPage = ReadonlyManPage

# Test program.
# usage: ManPage [manpage]; or ManPage [-f] file
# -f means that the file is nroff -man output run through ul -i
def test():
    import os
    import sys
    # XXX This directory may be different on your system
    MANDIR = '/usr/local/man/mann'
    DEFAULTPAGE = 'Tcl'
    formatted = 0
    if sys.argv[1:] and sys.argv[1] == '-f':
        formatted = 1
        del sys.argv[1]
    if sys.argv[1:]:
        name = sys.argv[1]
    else:
        name = DEFAULTPAGE
    if not formatted:
        if name[-2:-1] != '.':
            name = name + '.n'
        name = os.path.join(MANDIR, name)
    root = Tk()
    root.minsize(1, 1)
    manpage = ManPage(root, relief=SUNKEN, borderwidth=2)
    manpage.pack(expand=1, fill=BOTH)
    if formatted:
        fp = open(name, 'r')
    else:
        fp = os.popen('nroff -man %s | ul -i' % name, 'r')
    manpage.parsefile(fp)
    root.mainloop()

# Run the test program when called as a script
if __name__ == '__main__':
    test()
PK�
Q\^�����guido/wish.pycnu�[����
��^c@sddlZddlZejejdddd�Zejd�dZx�er\dZndZyee�Z	Wne
k
r�PnXee	d	Zejejd
de��rMeje	�yejde�Z
Wnejk
r�Zd
GeGHnXe
re
GHndZqMqMWdS(i����NtDISPLAYtwishtTkitupdatets% s
tinfotcompletetevals	TclError:(t_tkintertostcreatetenvironttktcalltcmdtpromptt	raw_inputtlinetEOFErrort
getbooleantrecordtresulttTclErrortmsg(((s//usr/lib64/python2.7/Demo/tkinter/guido/wish.pyt<module>s,
	


PK�
Q\%L��guido/brownian2.pycnu�[����
��^c@s�ddlTddlZddlZdZdZdZdZdZdZdZ	da
dad	�Z
d
�Zd�Zedkr�e�ndS(
i����(t*Ni�i,i
itrediccs�t}tjtdt�}tjtdt�}|j||||||||dt�}x_ts�tjdt	�}tjdt	�}y|j
|||�Wntk
r�PqcXdVqcWdS(Ng@tfilli(
tRADIUStrandomtgausstWIDTHtSIGMAtHEIGHTtcreate_ovaltFILLtstoptBUZZtmovetTclErrortNone(tcanvastrtxtytptdxtdy((s4/usr/lib64/python2.7/Demo/tkinter/guido/brownian2.pytparticles.	
cCs:|j�tjt�}tjt|d�t|�dS(Ni�(tnextRtexpovariatetLAMBDAtroottaftertintR
(Rtdt((s4/usr/lib64/python2.7/Demo/tkinter/guido/brownian2.pyR
"s
cCs�t�attdtdt�}|jdddd�d}tjdr`ttjd�}nx$t	|�D]}t
t|��qmWztj�Wdda
XdS(NtwidththeightRtbothtexpandii(tTkRtCanvasRRtpacktsystargvRtrangeR
RtmainloopR(Rtnpti((s4/usr/lib64/python2.7/Demo/tkinter/guido/brownian2.pytmain's	
t__main__(tTkinterRR&RRRRRRR
RRRRR
R,t__name__(((s4/usr/lib64/python2.7/Demo/tkinter/guido/brownian2.pyt<module>s 
			PK�
Q\E`}eR	R	guido/electrons.pycnu�[����
Afc@sLddlTddlZddd��YZd�ZedkrHe�ndS(i����(t*Nt	ElectronscBs&eZdd�Zd�Zd�ZRS(c
Cs||_t�|_}t|�|_}|j�|j|d�|j|d�}}|r�|j|d|dd|dd�|_ng|_	d
\}}}	}
xWt
|�D]I}|j|||	|
dd�}|j	j|�|d|
d}}
q�W|jj
�dS(Ntwidththeightitbitmapt
foregroundtbluei
iFiiJtfilltred(i
iFiiJ(tntTkttktCanvastcanvastpacktgetintt
create_bitmapRtpiecestrangetcreate_ovaltappendtupdate(
tselfR	RRtcRRtx1ty1tx2ty2titp((s4/usr/lib64/python2.7/Demo/tkinter/guido/electrons.pyt__init__s 	
'	cCsq|j}xT|jD]I}tjtdd��}tjtdd��}|j|||�qW|jj�dS(Ni����ii����(R
RtrandomtchoiceRtmoveRR(RR	RRtxty((s4/usr/lib64/python2.7/Demo/tkinter/guido/electrons.pytrandom_move+s	cCshy+x$td�D]}|j|j�qWWn6tk
rcy|jj�Wqdtk
r_qdXnXdS(Ni�(RR$R	tTclErrorRtdestroy(RR((s4/usr/lib64/python2.7/Demo/tkinter/guido/electrons.pytrun4s

N(t__name__t
__module__tNoneRR$R'(((s4/usr/lib64/python2.7/Demo/tkinter/guido/electrons.pyRs		cCs�ddl}ddl}|jdr>|j|jd�}nd}|jdr�|jd}|ddkr{|d}q�d|}nd}t||�}|j�dS(Ni����iiiit@(tsyststringtargvtatoiR*RR'(R,R-R	Rth((s4/usr/lib64/python2.7/Demo/tkinter/guido/electrons.pytmain@s




t__main__((tTkinterRRR1R((((s4/usr/lib64/python2.7/Demo/tkinter/guido/electrons.pyt<module>s

-	PK�
Q\���X�#�#guido/tkman.pyonu�[����
Afc@s�ddlZddlZddlZddlZddlTddlmZddgZddgZdZx/eD]'Z	ej
je	�roe	Zd	ZqoqoWdZ
x/eD]'Z	ej
je	�r�e	Zd	Z
q�q�Wes�e
r\ejjd
�esdejdZejjde�ne
sLd
ejdZejjde�nejd	�n[[
d�Zddd��YZd�Ze�dS(i����N(t*(tManPages/depot/sundry/man/manns/usr/local/man/manns/depot/sundry/man/man3s/usr/local/man/man3iis
sgFailed to find mann directory.
Please add the correct entry to the MANNDIRLIST
at the top of %s script.s%s

sgFailed to find man3 directory.
Please add the correct entry to the MAN3DIRLIST
at the top of %s script.cCsktj|�}g}xE|D]=}|dd!dkr|ddkr|j|d �qqW|j�|S(Ni����i����t.tln123456789(tostlistdirtappendtsort(tmandirtfilestnamestfile((s0/usr/lib64/python2.7/Demo/tkinter/guido/tkman.pytlistmanpages0s
#
tSelectionBoxcBs�eZdd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
d�Zd�Zd
�ZRS(cCs�g|_t|dd�|_|jjdddt�|jj|_t|jdd�|_|jjdddt�t|jdd�|_|jjd	tdddt�t|jdd
�|_	|j	jd	t
dddt�t|�|_t
|j	dddd
dtdd�|_|jjd	t�t|jdd�|_|jjdddtd|jd|j�|jjdddtd|jd|j�|j|jd<t|j	dddtdddddd�|_|jjdddt�t|jddddd|j�|_|jjd	t�t|jdd dtdddd�|_|jjdddt�t|jdd!�|_ |j jdddt!�t|j dd"dd#d|j"�|_#|j#jd	t�t$�|_%t&|j dd$dd%d|j%dt'�|_(|j(jd	t�t|jdd&dtdddd�|_)|j)jdddt�t*|jdd'dd(�|_+|j+jd	t,�t-|jdddtddd)t!dd*d+d,�|_.|j.jdddt�|jj/d-|j�|j)j/d-|j"�|jj/d.|j0�|jj/d/|j1�|j)j/d/|j2�|j.j/d/|j3�|jj4�|jj5t�|j�dS(0Ntnametframetexpanditfilltsubframeitleftsubframetsidet
rightsubframetchapterttextt	DirectorytrelieftborderwidthitchaptermenutlabelsC functionstvaluetvariabletcommandsTcl/Tk functionstmenutlistboxtwidthitheightitl1sDisplay manual page named:tentrytl2frametl2sSearch regexp:t	casesensesCase sensitivetsearchttitles(none)twrapiHtselectbackgroundtpinks<Return>s
<Double-1>s<Tab>(6tchoicestFrameRtpacktBOTHtmasterRRtLEFTRtRIGHTt	StringVart
chaptervart
MenubuttontRAISEDRtTOPtMenuRtadd_radiobuttontMAN3DIRt
newchaptertMANNDIRtListboxtSUNKENR!tButtontentry_cbR$tEntryR%tXR&tNONEt	search_cbR't
BooleanVartcasevartCheckbuttontFLATR(R)tLabelR*tBOTTOMRRtbindt
listbox_cbt	entry_tabt
search_tabttext_tabt	focus_settset(tselfR2((s0/usr/lib64/python2.7/Demo/tkinter/guido/tkman.pyt__init__;s�		
	
	
cCs/|jj�}g|_|jt|��dS(N(R6tgetR.taddlistR(RTR((s0/usr/lib64/python2.7/Demo/tkinter/guido/tkman.pyR=�s	cCs=||jkr/|jj|�|jj�n|j�dS(N(R.RRtupdate(RTtchoice((s0/usr/lib64/python2.7/Demo/tkinter/guido/tkman.pyt	addchoice�scCs1||jt|j�)|jj�|j�dS(N(R.tlenRRX(RTtlist((s0/usr/lib64/python2.7/Demo/tkinter/guido/tkman.pyRW�s
cGs|j�dS(N(RX(RTte((s0/usr/lib64/python2.7/Demo/tkinter/guido/tkman.pyRB�scCsQ|jj�}|rMt|�dkrM|jj|d�}|j|�ndS(Nii(R!tcurselectionR[RVt	show_page(RTR]t	selectionR((s0/usr/lib64/python2.7/Demo/tkinter/guido/tkman.pyRN�scGs|j|jj��dS(N(t
search_stringR)RV(RTR]((s0/usr/lib64/python2.7/Demo/tkinter/guido/tkman.pyRF�scCs|jj�dS(N(R)RR(RTR]((s0/usr/lib64/python2.7/Demo/tkinter/guido/tkman.pyRO�scCs|jj�dS(N(R%RR(RTR]((s0/usr/lib64/python2.7/Demo/tkinter/guido/tkman.pyRP�scCs|jj�dS(N(R%RR(RTR]((s0/usr/lib64/python2.7/Demo/tkinter/guido/tkman.pyRQ�scCs�|jj�}t|t|�d�|j�}|sF|jj�n|jjdt	��d}x9|D]1}||kr�d}n|jj
t	�|�qiW|r�|S|jj�}|dkr�|jjd�SdS(NcSs|| |kS(N((Rtkeytn((s0/usr/lib64/python2.7/Demo/tkinter/guido/tkman.pyt<lambda>�tii(R%RVtfilterR[R.RtbellR!tdeletetAtEndtinserttsize(RTRbtokt
exactmatchtitemRc((s0/usr/lib64/python2.7/Demo/tkinter/guido/tkman.pyt
updatelist�s 
	cCsF|j�}|rB|j|�|jjdt��|j�ndS(Ni(RoR_R%RhRi(RTR((s0/usr/lib64/python2.7/Demo/tkinter/guido/tkman.pyRX�s

cCs]d|jj�|f}tjd|d�}|jj�||jd<|jj|�dS(Ns%s/%s.?snroff -man %s | ul -itrR(R6RVRtpopenRtkillR*t	parsefile(RTRRtfp((s0/usr/lib64/python2.7/Demo/tkinter/guido/tkman.pyR_�s


cCs`|s|jj�dGHdS|jj�s7tj}nd}y.|r[tj||�}ntj|�}Wn-tjk
r�}|jj�dG|GHdSX|j	j
t��}tj
|tj|d� �}|j	j
t��}tj
|tj|d� �}|}	d}
x4|d}||krM|	dkr8Pn|	}d}d}	n|j	jd|d|�}|j|�}|dkrd}
tdt|jd���}
y |j	jdt�t��Wntk
r�nX|j	jdd	||fd	|||
f�|j	jt�d	||f�|j	jt��PqqW|
s\|jj�ndS(
NsEmpty search stringsRegex error:Riis%d.0 linestarts%d.0 lineendtsels%d.%d(RRgRHRVtret
IGNORECASEtNonetcompileterrorRtindextAtInserttstringtatoitfindRiR)tmaxR[tgroupt
tag_removet
AtSelFirstt	AtSelLasttTclErrorttag_addtmark_settyview_pickplace(RTR)tmaptprogtmsgtheretlinenotendt	endlinenot
wraplinenotfoundtlinetiRc((s0/usr/lib64/python2.7/Demo/tkinter/guido/tkman.pyRa�sd

	
	


N(t__name__t
__module__RxRUR=RZRWRBRNRFRORPRQRoRXR_Ra(((s0/usr/lib64/python2.7/Demo/tkinter/guido/tkman.pyR
9sM												cCsWt�}t|�}tjdr9|jtjd�n|jdd�|j�dS(Ni(tTkR
tsystargvR_tminsizetmainloop(troottsb((s0/usr/lib64/python2.7/Demo/tkinter/guido/tkman.pytmains	
((R�RR}RvtTkinterRtMANNDIRLISTtMAN3DIRLISTtfoundmanndirtdirtpathtexistsR>tfoundman3dirR<tstderrtwriteR�R�texitRR
R�(((s0/usr/lib64/python2.7/Demo/tkinter/guido/tkman.pyt<module>sD




		�	PK�
Q\�h��guido/imagedraw.pyonu�[����
��^c@s9dZddlTddlZd�Zd�Ze�dS(sDraw on top of an imagei����(t*NcCs�tjd}t�}td|�}|j�|j�}}t|d|d|�}|jdddtd|�|j	�|j
dt�|j�dS(	Nitfiletwidththeightitanchortimages
<Button-1>(
tsystargvtTkt
PhotoImageRRtCanvastcreate_imagetNWtpacktbindtblobtmainloop(tfilenametroottimgtwthtcanv((s4/usr/lib64/python2.7/Demo/tkinter/guido/imagedraw.pytmains
	
c	CsX|j|j}}|j}d}|j||||||||dddd�dS(Nitfilltredtoutlinet(txtytwidgettcreate_oval(teventRRRtr((s4/usr/lib64/python2.7/Demo/tkinter/guido/imagedraw.pyRs	(t__doc__tTkinterRRR(((s4/usr/lib64/python2.7/Demo/tkinter/guido/imagedraw.pyt<module>s

		PK�
Q\��LLguido/ShellWindow.pynu�[���import os
import sys
import string
from Tkinter import *
from ScrolledText import ScrolledText
from Dialog import Dialog
import signal

BUFSIZE = 512

class ShellWindow(ScrolledText):

    def __init__(self, master=None, shell=None, **cnf):
        if not shell:
            try:
                shell = os.environ['SHELL']
            except KeyError:
                shell = '/bin/sh'
            shell = shell + ' -i'
        args = string.split(shell)
        shell = args[0]

        apply(ScrolledText.__init__, (self, master), cnf)
        self.pos = '1.0'
        self.bind('<Return>', self.inputhandler)
        self.bind('<Control-c>', self.sigint)
        self.bind('<Control-t>', self.sigterm)
        self.bind('<Control-k>', self.sigkill)
        self.bind('<Control-d>', self.sendeof)

        self.pid, self.fromchild, self.tochild = spawn(shell, args)
        self.tk.createfilehandler(self.fromchild, READABLE,
                                  self.outputhandler)

    def outputhandler(self, file, mask):
        data = os.read(file, BUFSIZE)
        if not data:
            self.tk.deletefilehandler(file)
            pid, sts = os.waitpid(self.pid, 0)
            print 'pid', pid, 'status', sts
            self.pid = None
            detail = sts>>8
            cause = sts & 0xff
            if cause == 0:
                msg = "exit status %d" % detail
            else:
                msg = "killed by signal %d" % (cause & 0x7f)
                if cause & 0x80:
                    msg = msg + " -- core dumped"
            Dialog(self.master,
                   text=msg,
                   title="Exit status",
                   bitmap='warning',
                   default=0,
                   strings=('OK',))
            return
        self.insert(END, data)
        self.pos = self.index("end - 1 char")
        self.yview_pickplace(END)

    def inputhandler(self, *args):
        if not self.pid:
            self.no_process()
            return "break"
        self.insert(END, "\n")
        line = self.get(self.pos, "end - 1 char")
        self.pos = self.index(END)
        os.write(self.tochild, line)
        return "break"

    def sendeof(self, *args):
        if not self.pid:
            self.no_process()
            return "break"
        os.close(self.tochild)
        return "break"

    def sendsig(self, sig):
        if not self.pid:
            self.no_process()
            return "break"
        os.kill(self.pid, sig)
        return "break"

    def sigint(self, *args):
        return self.sendsig(signal.SIGINT)

    def sigquit(self, *args):
        return self.sendsig(signal.SIGQUIT)

    def sigterm(self, *args):
        return self.sendsig(signal.SIGTERM)

    def sigkill(self, *args):
        return self.sendsig(signal.SIGKILL)

    def no_process(self):
        Dialog(self.master,
               text="No active process",
               title="No process",
               bitmap='error',
               default=0,
               strings=('OK',))

MAXFD = 100     # Max number of file descriptors (os.getdtablesize()???)

def spawn(prog, args):
    p2cread, p2cwrite = os.pipe()
    c2pread, c2pwrite = os.pipe()
    pid = os.fork()
    if pid == 0:
        # Child
        for i in 0, 1, 2:
            try:
                os.close(i)
            except os.error:
                pass
        if os.dup(p2cread) <> 0:
            sys.stderr.write('popen2: bad read dup\n')
        if os.dup(c2pwrite) <> 1:
            sys.stderr.write('popen2: bad write dup\n')
        if os.dup(c2pwrite) <> 2:
            sys.stderr.write('popen2: bad write dup\n')
        os.closerange(3, MAXFD)
        try:
            os.execvp(prog, args)
        finally:
            sys.stderr.write('execvp failed\n')
            os._exit(1)
    os.close(p2cread)
    os.close(c2pwrite)
    return pid, c2pread, p2cwrite

def test():
    shell = string.join(sys.argv[1:])
    root = Tk()
    root.minsize(1, 1)
    if shell:
        w = ShellWindow(root, shell=shell)
    else:
        w = ShellWindow(root)
    w.pack(expand=1, fill=BOTH)
    w.focus_set()
    w.tk.mainloop()

if __name__ == '__main__':
    test()
PK�
Q\`�xIIguido/hanoi.pycnu�[����
��^c@sIddlTd�Zddd��YZd�ZedkrEe�ndS(	i����(t*cCsX|dkrdSt|d||||�||||�t|d||||�dS(Nii(thanoi(tntatbtctreport((s0/usr/lib64/python2.7/Demo/tkinter/guido/hanoi.pyRs
tTkhanoicBs&eZdd�Zd�Zd�ZRS(cCs�||_t�|_}t|�|_}|j�|j|d�|j|d�}}|r�|j|d|dd|dd�|_nd}|d}|d}	|	|d|d	d}
}|
|||}}
g|_	|j
|
|||
d
d�}|j	j|�|
|	||	}
}|j
|
|||
d
d�}|j	j|�|
|	||	}
}|j
|
|||
d
d�}|j	j|�|jj�|d}|	dd}d|}gggg|_
i|_|	|d|
|d}
}|
|||}}
||dtd	|d	�}x�t|d
d�D]�}|j
|
|||
d
d�}||j|<|j
d
j|�|
|||}
}||d|
|d}}
|jj�|jjd�qFWdS(Ntwidththeightitbitmapt
foregroundtbluei
iitfilltblackiii����tredi(RtTkttktCanvastcanvastpacktgetintt
create_bitmapR
tpegstcreate_rectangletappendtupdatetpegstatetpiecestmaxtrangetafter(tselfRR
RRRR	tpegwidtht	pegheighttpegdisttx1ty1tx2ty2tptpieceheightt
maxpiecewidtht
minpiecewidthtdxti((s0/usr/lib64/python2.7/Demo/tkinter/guido/hanoi.pyt__init__sP	
'

	


	

cCs�x�t|jddd|j�t|jddd|j�t|jddd|j�t|jddd|j�t|jddd|j�t|jddd|j�qWdS(Niii(RRR(R ((s0/usr/lib64/python2.7/Demo/tkinter/guido/hanoi.pytrunNscCs�|j|d|kr t�n|j|d=|j|}|j}|j|j|�\}}}}	xO|j|�\}
}}}
|
|kr�Pn|j|dd�|jj�qiW|j|j|�\}}}}||d}x|j|�\}
}}}
|
|d}||kr$Pn||krF|j|dd�n|j|dd�|jj�q�W|
|}||t	|j|�d}xO|j|�\}
}}}
|
|kr�Pn|j|dd�|jj�q�W|j|j
|�dS(Ni����iii(RtRuntimeErrorRRtbboxRtmoveRRtlenR(R R-RRR(Rtax1tay1tax2tay2R$R%R&R'tbx1tby1tbx2tby2t	newcentertcenterR)t	newbottom((s0/usr/lib64/python2.7/Demo/tkinter/guido/hanoi.pyRXs@	
	""
N(t__name__t
__module__tNoneR.R/R(((s0/usr/lib64/python2.7/Demo/tkinter/guido/hanoi.pyRs1	
cCs�ddl}ddl}|jdr>|j|jd�}nd}|jdr�|jd}|ddkr{|d}q�d|}nd}t||�}|j�dS(Ni����iiiit@(tsyststringtargvtatoiRARR/(RCRDRR
th((s0/usr/lib64/python2.7/Demo/tkinter/guido/hanoi.pytmains




t__main__N((tTkinterRRRHR?(((s0/usr/lib64/python2.7/Demo/tkinter/guido/hanoi.pyt<module>
s

	e	PK�
Q\~H�+��guido/ShellWindow.pycnu�[����
��^c@s�ddlZddlZddlZddlTddlmZddlmZddlZdZdefd��YZdZ	d	�Z
d
�Zedkr�e�ndS(i����N(t*(tScrolledText(tDialogitShellWindowcBsheZd
d
d�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd	�ZRS(cKs|s>ytjd}Wntk
r0d}nX|d}ntj|�}|d}ttj||f|�d|_|j	d|j
�|j	d|j�|j	d|j�|j	d	|j
�|j	d
|j�t||�\|_|_|_|jj|jt|j�dS(NtSHELLs/bin/shs -iis1.0s<Return>s<Control-c>s<Control-t>s<Control-k>s<Control-d>(tostenvirontKeyErrortstringtsplittapplyRt__init__tpostbindtinputhandlertsiginttsigtermtsigkilltsendeoftspawntpidt	fromchildttochildttktcreatefilehandlertREADABLEt
outputhandler(tselftmastertshelltcnftargs((s6/usr/lib64/python2.7/Demo/tkinter/guido/ShellWindow.pyR
s$



	!c	Cstj|t�}|s�|jj|�tj|jd�\}}dG|GdG|GHd|_|d?}|d@}|dkr�d|}n%d|d@}|d	@r�|d
}nt|j	d|dd
dddddd�dS|j
t|�|jd�|_
|jt�dS(NiRtstatusii�sexit status %dskilled by signal %dii�s -- core dumpedttextttitlesExit statustbitmaptwarningtdefaulttstringstOKsend - 1 char(R'(RtreadtBUFSIZERtdeletefilehandlertwaitpidRtNoneRRtinserttENDtindexRtyview_pickplace(	RtfiletmasktdataRtststdetailtcausetmsg((s6/usr/lib64/python2.7/Demo/tkinter/guido/ShellWindow.pyR#s.	




cGse|js|j�dS|jtd�|j|jd�}|jt�|_tj|j	|�dS(Ntbreaks
send - 1 char(
Rt
no_processR-R.tgetRR/RtwriteR(RRtline((s6/usr/lib64/python2.7/Demo/tkinter/guido/ShellWindow.pyR=s	
cGs+|js|j�dStj|j�dS(NR8(RR9RtcloseR(RR((s6/usr/lib64/python2.7/Demo/tkinter/guido/ShellWindow.pyRGs
	
cCs.|js|j�dStj|j|�dS(NR8(RR9Rtkill(Rtsig((s6/usr/lib64/python2.7/Demo/tkinter/guido/ShellWindow.pytsendsigNs
	
cGs|jtj�S(N(R@tsignaltSIGINT(RR((s6/usr/lib64/python2.7/Demo/tkinter/guido/ShellWindow.pyRUscGs|jtj�S(N(R@RAtSIGQUIT(RR((s6/usr/lib64/python2.7/Demo/tkinter/guido/ShellWindow.pytsigquitXscGs|jtj�S(N(R@RAtSIGTERM(RR((s6/usr/lib64/python2.7/Demo/tkinter/guido/ShellWindow.pyR[scGs|jtj�S(N(R@RAtSIGKILL(RR((s6/usr/lib64/python2.7/Demo/tkinter/guido/ShellWindow.pyR^scCs/t|jddddddddd	d�dS(NR!sNo active processR"s
No processR#terrorR%iR&R'(R'(RR(R((s6/usr/lib64/python2.7/Demo/tkinter/guido/ShellWindow.pyR9asN(
t__name__t
__module__R,RRRRR@RRDRRR9(((s6/usr/lib64/python2.7/Demo/tkinter/guido/ShellWindow.pyRs		
						idcCs\tj�\}}tj�\}}tj�}|dkr5x6dD].}ytj|�WqCtjk
rpqCXqCWtj|�dkr�tjjd�ntj|�dkr�tjjd�ntj|�dkr�tjjd�ntj	dt
�ztj||�Wdtjjd�tjd�Xntj|�tj|�|||fS(	Niiispopen2: bad read dup
spopen2: bad write dup
isexecvp failed
(iii(
RtpipetforkR=RGtduptsyststderrR;t
closerangetMAXFDtexecvpt_exit(tprogRtp2creadtp2cwritetc2preadtc2pwriteRti((s6/usr/lib64/python2.7/Demo/tkinter/guido/ShellWindow.pyRks.


cCs�tjtjd�}t�}|jdd�|rJt|d|�}nt|�}|jdddt�|j	�|j
j�dS(NiRtexpandtfill(RtjoinRMtargvtTktminsizeRtpacktBOTHt	focus_setRtmainloop(Rtroottw((s6/usr/lib64/python2.7/Demo/tkinter/guido/ShellWindow.pyttest�s	
t__main__(
RRMRtTkinterRRRAR)RRPRReRH(((s6/usr/lib64/python2.7/Demo/tkinter/guido/ShellWindow.pyt<module>s
^		PK�
Q\n�`�		guido/electrons.pynuȯ��#! /usr/bin/python2.7

# Simulate "electrons" migrating across the screen.
# An optional bitmap file in can be in the background.
#
# Usage: electrons [n [bitmapfile]]
#
# n is the number of electrons to animate; default is 30.
#
# The bitmap file can be any X11 bitmap file (look in
# /usr/include/X11/bitmaps for samples); it is displayed as the
# background of the animation.  Default is no bitmap.

from Tkinter import *
import random


# The graphical interface
class Electrons:

    # Create our objects
    def __init__(self, n, bitmap = None):
        self.n = n
        self.tk = tk = Tk()
        self.canvas = c = Canvas(tk)
        c.pack()
        width, height = tk.getint(c['width']), tk.getint(c['height'])

        # Add background bitmap
        if bitmap:
            self.bitmap = c.create_bitmap(width/2, height/2,
                                          bitmap=bitmap,
                                          foreground='blue')

        self.pieces = []
        x1, y1, x2, y2 = 10,70,14,74
        for i in range(n):
            p = c.create_oval(x1, y1, x2, y2, fill='red')
            self.pieces.append(p)
            y1, y2 = y1 +2, y2 + 2
        self.tk.update()

    def random_move(self, n):
        c = self.canvas
        for p in self.pieces:
            x = random.choice(range(-2,4))
            y = random.choice(range(-3,4))
            c.move(p, x, y)
        self.tk.update()

    # Run -- allow 500 movemens
    def run(self):
        try:
            for i in range(500):
                self.random_move(self.n)
        except TclError:
            try:
                self.tk.destroy()
            except TclError:
                pass


# Main program
def main():
    import sys, string

    # First argument is number of electrons, default 30
    if sys.argv[1:]:
        n = string.atoi(sys.argv[1])
    else:
        n = 30

    # Second argument is bitmap file, default none
    if sys.argv[2:]:
        bitmap = sys.argv[2]
        # Reverse meaning of leading '@' compared to Tk
        if bitmap[0] == '@': bitmap = bitmap[1:]
        else: bitmap = '@' + bitmap
    else:
        bitmap = None

    # Create the graphical objects...
    h = Electrons(n, bitmap)

    # ...and run!
    h.run()


# Call main when run as script
if __name__ == '__main__':
    main()
PK�
Q\`�xIIguido/hanoi.pyonu�[����
��^c@sIddlTd�Zddd��YZd�ZedkrEe�ndS(	i����(t*cCsX|dkrdSt|d||||�||||�t|d||||�dS(Nii(thanoi(tntatbtctreport((s0/usr/lib64/python2.7/Demo/tkinter/guido/hanoi.pyRs
tTkhanoicBs&eZdd�Zd�Zd�ZRS(cCs�||_t�|_}t|�|_}|j�|j|d�|j|d�}}|r�|j|d|dd|dd�|_nd}|d}|d}	|	|d|d	d}
}|
|||}}
g|_	|j
|
|||
d
d�}|j	j|�|
|	||	}
}|j
|
|||
d
d�}|j	j|�|
|	||	}
}|j
|
|||
d
d�}|j	j|�|jj�|d}|	dd}d|}gggg|_
i|_|	|d|
|d}
}|
|||}}
||dtd	|d	�}x�t|d
d�D]�}|j
|
|||
d
d�}||j|<|j
d
j|�|
|||}
}||d|
|d}}
|jj�|jjd�qFWdS(Ntwidththeightitbitmapt
foregroundtbluei
iitfilltblackiii����tredi(RtTkttktCanvastcanvastpacktgetintt
create_bitmapR
tpegstcreate_rectangletappendtupdatetpegstatetpiecestmaxtrangetafter(tselfRR
RRRR	tpegwidtht	pegheighttpegdisttx1ty1tx2ty2tptpieceheightt
maxpiecewidtht
minpiecewidthtdxti((s0/usr/lib64/python2.7/Demo/tkinter/guido/hanoi.pyt__init__sP	
'

	


	

cCs�x�t|jddd|j�t|jddd|j�t|jddd|j�t|jddd|j�t|jddd|j�t|jddd|j�qWdS(Niii(RRR(R ((s0/usr/lib64/python2.7/Demo/tkinter/guido/hanoi.pytrunNscCs�|j|d|kr t�n|j|d=|j|}|j}|j|j|�\}}}}	xO|j|�\}
}}}
|
|kr�Pn|j|dd�|jj�qiW|j|j|�\}}}}||d}x|j|�\}
}}}
|
|d}||kr$Pn||krF|j|dd�n|j|dd�|jj�q�W|
|}||t	|j|�d}xO|j|�\}
}}}
|
|kr�Pn|j|dd�|jj�q�W|j|j
|�dS(Ni����iii(RtRuntimeErrorRRtbboxRtmoveRRtlenR(R R-RRR(Rtax1tay1tax2tay2R$R%R&R'tbx1tby1tbx2tby2t	newcentertcenterR)t	newbottom((s0/usr/lib64/python2.7/Demo/tkinter/guido/hanoi.pyRXs@	
	""
N(t__name__t
__module__tNoneR.R/R(((s0/usr/lib64/python2.7/Demo/tkinter/guido/hanoi.pyRs1	
cCs�ddl}ddl}|jdr>|j|jd�}nd}|jdr�|jd}|ddkr{|d}q�d|}nd}t||�}|j�dS(Ni����iiiit@(tsyststringtargvtatoiRARR/(RCRDRR
th((s0/usr/lib64/python2.7/Demo/tkinter/guido/hanoi.pytmains




t__main__N((tTkinterRRRHR?(((s0/usr/lib64/python2.7/Demo/tkinter/guido/hanoi.pyt<module>
s

	e	PK�
Q\D����guido/optionmenu.pynu�[���# option menu sample (Fredrik Lundh, September 1997)

from Tkinter import *

root = Tk()

#
# standard usage

var1  = StringVar()
var1.set("One") # default selection

menu1 = OptionMenu(root, var1, "One", "Two", "Three")
menu1.pack()

#
# initialize from a sequence

CHOICES = "Aah", "Bee", "Cee", "Dee", "Eff"

var2  = StringVar()
var2.set(CHOICES[0])

menu2 = apply(OptionMenu, (root, var2) + tuple(CHOICES))
menu2.pack()

root.mainloop()
PK�
Q\�#��guido/imageview.pynu�[���from Tkinter import *
import sys

def main():
    filename = sys.argv[1]
    root = Tk()
    img = PhotoImage(file=filename)
    label = Label(root, image=img)
    label.pack()
    root.mainloop()

main()
PK�
Q\��GfGfguido/ss1.pynu�[���"""SS1 -- a spreadsheet."""

import os
import re
import sys
import cgi
import rexec
from xml.parsers import expat

LEFT, CENTER, RIGHT = "LEFT", "CENTER", "RIGHT"

def ljust(x, n):
    return x.ljust(n)
def center(x, n):
    return x.center(n)
def rjust(x, n):
    return x.rjust(n)
align2action = {LEFT: ljust, CENTER: center, RIGHT: rjust}

align2xml = {LEFT: "left", CENTER: "center", RIGHT: "right"}
xml2align = {"left": LEFT, "center": CENTER, "right": RIGHT}

align2anchor = {LEFT: "w", CENTER: "center", RIGHT: "e"}

def sum(seq):
    total = 0
    for x in seq:
        if x is not None:
            total += x
    return total

class Sheet:

    def __init__(self):
        self.cells = {} # {(x, y): cell, ...}
        self.rexec = rexec.RExec()
        m = self.rexec.add_module('__main__')
        m.cell = self.cellvalue
        m.cells = self.multicellvalue
        m.sum = sum

    def cellvalue(self, x, y):
        cell = self.getcell(x, y)
        if hasattr(cell, 'recalc'):
            return cell.recalc(self.rexec)
        else:
            return cell

    def multicellvalue(self, x1, y1, x2, y2):
        if x1 > x2:
            x1, x2 = x2, x1
        if y1 > y2:
            y1, y2 = y2, y1
        seq = []
        for y in range(y1, y2+1):
            for x in range(x1, x2+1):
                seq.append(self.cellvalue(x, y))
        return seq

    def getcell(self, x, y):
        return self.cells.get((x, y))

    def setcell(self, x, y, cell):
        assert x > 0 and y > 0
        assert isinstance(cell, BaseCell)
        self.cells[x, y] = cell

    def clearcell(self, x, y):
        try:
            del self.cells[x, y]
        except KeyError:
            pass

    def clearcells(self, x1, y1, x2, y2):
        for xy in self.selectcells(x1, y1, x2, y2):
            del self.cells[xy]

    def clearrows(self, y1, y2):
        self.clearcells(0, y1, sys.maxint, y2)

    def clearcolumns(self, x1, x2):
        self.clearcells(x1, 0, x2, sys.maxint)

    def selectcells(self, x1, y1, x2, y2):
        if x1 > x2:
            x1, x2 = x2, x1
        if y1 > y2:
            y1, y2 = y2, y1
        return [(x, y) for x, y in self.cells
                if x1 <= x <= x2 and y1 <= y <= y2]

    def movecells(self, x1, y1, x2, y2, dx, dy):
        if dx == 0 and dy == 0:
            return
        if x1 > x2:
            x1, x2 = x2, x1
        if y1 > y2:
            y1, y2 = y2, y1
        assert x1+dx > 0 and y1+dy > 0
        new = {}
        for x, y in self.cells:
            cell = self.cells[x, y]
            if hasattr(cell, 'renumber'):
                cell = cell.renumber(x1, y1, x2, y2, dx, dy)
            if x1 <= x <= x2 and y1 <= y <= y2:
                x += dx
                y += dy
            new[x, y] = cell
        self.cells = new

    def insertrows(self, y, n):
        assert n > 0
        self.movecells(0, y, sys.maxint, sys.maxint, 0, n)

    def deleterows(self, y1, y2):
        if y1 > y2:
            y1, y2 = y2, y1
        self.clearrows(y1, y2)
        self.movecells(0, y2+1, sys.maxint, sys.maxint, 0, y1-y2-1)

    def insertcolumns(self, x, n):
        assert n > 0
        self.movecells(x, 0, sys.maxint, sys.maxint, n, 0)

    def deletecolumns(self, x1, x2):
        if x1 > x2:
            x1, x2 = x2, x1
        self.clearcells(x1, x2)
        self.movecells(x2+1, 0, sys.maxint, sys.maxint, x1-x2-1, 0)

    def getsize(self):
        maxx = maxy = 0
        for x, y in self.cells:
            maxx = max(maxx, x)
            maxy = max(maxy, y)
        return maxx, maxy

    def reset(self):
        for cell in self.cells.itervalues():
            if hasattr(cell, 'reset'):
                cell.reset()

    def recalc(self):
        self.reset()
        for cell in self.cells.itervalues():
            if hasattr(cell, 'recalc'):
                cell.recalc(self.rexec)

    def display(self):
        maxx, maxy = self.getsize()
        width, height = maxx+1, maxy+1
        colwidth = [1] * width
        full = {}
        # Add column heading labels in row 0
        for x in range(1, width):
            full[x, 0] = text, alignment = colnum2name(x), RIGHT
            colwidth[x] = max(colwidth[x], len(text))
        # Add row labels in column 0
        for y in range(1, height):
            full[0, y] = text, alignment = str(y), RIGHT
            colwidth[0] = max(colwidth[0], len(text))
        # Add sheet cells in columns with x>0 and y>0
        for (x, y), cell in self.cells.iteritems():
            if x <= 0 or y <= 0:
                continue
            if hasattr(cell, 'recalc'):
                cell.recalc(self.rexec)
            if hasattr(cell, 'format'):
                text, alignment = cell.format()
                assert isinstance(text, str)
                assert alignment in (LEFT, CENTER, RIGHT)
            else:
                text = str(cell)
                if isinstance(cell, str):
                    alignment = LEFT
                else:
                    alignment = RIGHT
            full[x, y] = (text, alignment)
            colwidth[x] = max(colwidth[x], len(text))
        # Calculate the horizontal separator line (dashes and dots)
        sep = ""
        for x in range(width):
            if sep:
                sep += "+"
            sep += "-"*colwidth[x]
        # Now print The full grid
        for y in range(height):
            line = ""
            for x in range(width):
                text, alignment = full.get((x, y)) or ("", LEFT)
                text = align2action[alignment](text, colwidth[x])
                if line:
                    line += '|'
                line += text
            print line
            if y == 0:
                print sep

    def xml(self):
        out = ['<spreadsheet>']
        for (x, y), cell in self.cells.iteritems():
            if hasattr(cell, 'xml'):
                cellxml = cell.xml()
            else:
                cellxml = '<value>%s</value>' % cgi.escape(cell)
            out.append('<cell row="%s" col="%s">\n  %s\n</cell>' %
                       (y, x, cellxml))
        out.append('</spreadsheet>')
        return '\n'.join(out)

    def save(self, filename):
        text = self.xml()
        f = open(filename, "w")
        f.write(text)
        if text and not text.endswith('\n'):
            f.write('\n')
        f.close()

    def load(self, filename):
        f = open(filename, 'r')
        SheetParser(self).parsefile(f)
        f.close()

class SheetParser:

    def __init__(self, sheet):
        self.sheet = sheet

    def parsefile(self, f):
        parser = expat.ParserCreate()
        parser.StartElementHandler = self.startelement
        parser.EndElementHandler = self.endelement
        parser.CharacterDataHandler = self.data
        parser.ParseFile(f)

    def startelement(self, tag, attrs):
        method = getattr(self, 'start_'+tag, None)
        if method:
            for key, value in attrs.iteritems():
                attrs[key] = str(value) # XXX Convert Unicode to 8-bit
            method(attrs)
        self.texts = []

    def data(self, text):
        text = str(text) # XXX Convert Unicode to 8-bit
        self.texts.append(text)

    def endelement(self, tag):
        method = getattr(self, 'end_'+tag, None)
        if method:
            method("".join(self.texts))

    def start_cell(self, attrs):
        self.y = int(attrs.get("row"))
        self.x = int(attrs.get("col"))

    def start_value(self, attrs):
        self.fmt = attrs.get('format')
        self.alignment = xml2align.get(attrs.get('align'))

    start_formula = start_value

    def end_int(self, text):
        try:
            self.value = int(text)
        except:
            self.value = None

    def end_long(self, text):
        try:
            self.value = long(text)
        except:
            self.value = None

    def end_double(self, text):
        try:
            self.value = float(text)
        except:
            self.value = None

    def end_complex(self, text):
        try:
            self.value = complex(text)
        except:
            self.value = None

    def end_string(self, text):
        try:
            self.value = text
        except:
            self.value = None

    def end_value(self, text):
        if isinstance(self.value, BaseCell):
            self.cell = self.value
        elif isinstance(self.value, str):
            self.cell = StringCell(self.value,
                                   self.fmt or "%s",
                                   self.alignment or LEFT)
        else:
            self.cell = NumericCell(self.value,
                                    self.fmt or "%s",
                                    self.alignment or RIGHT)

    def end_formula(self, text):
        self.cell = FormulaCell(text,
                                self.fmt or "%s",
                                self.alignment or RIGHT)

    def end_cell(self, text):
        self.sheet.setcell(self.x, self.y, self.cell)

class BaseCell:
    __init__ = None # Must provide
    """Abstract base class for sheet cells.

    Subclasses may but needn't provide the following APIs:

    cell.reset() -- prepare for recalculation
    cell.recalc(rexec) -> value -- recalculate formula
    cell.format() -> (value, alignment) -- return formatted value
    cell.xml() -> string -- return XML
    """

class NumericCell(BaseCell):

    def __init__(self, value, fmt="%s", alignment=RIGHT):
        assert isinstance(value, (int, long, float, complex))
        assert alignment in (LEFT, CENTER, RIGHT)
        self.value = value
        self.fmt = fmt
        self.alignment = alignment

    def recalc(self, rexec):
        return self.value

    def format(self):
        try:
            text = self.fmt % self.value
        except:
            text = str(self.value)
        return text, self.alignment

    def xml(self):
        method = getattr(self, '_xml_' + type(self.value).__name__)
        return '<value align="%s" format="%s">%s</value>' % (
                align2xml[self.alignment],
                self.fmt,
                method())

    def _xml_int(self):
        if -2**31 <= self.value < 2**31:
            return '<int>%s</int>' % self.value
        else:
            return self._xml_long()

    def _xml_long(self):
        return '<long>%s</long>' % self.value

    def _xml_float(self):
        return '<double>%s</double>' % repr(self.value)

    def _xml_complex(self):
        return '<complex>%s</double>' % repr(self.value)

class StringCell(BaseCell):

    def __init__(self, text, fmt="%s", alignment=LEFT):
        assert isinstance(text, (str, unicode))
        assert alignment in (LEFT, CENTER, RIGHT)
        self.text = text
        self.fmt = fmt
        self.alignment = alignment

    def recalc(self, rexec):
        return self.text

    def format(self):
        return self.text, self.alignment

    def xml(self):
        s = '<value align="%s" format="%s"><string>%s</string></value>'
        return s % (
            align2xml[self.alignment],
            self.fmt,
            cgi.escape(self.text))

class FormulaCell(BaseCell):

    def __init__(self, formula, fmt="%s", alignment=RIGHT):
        assert alignment in (LEFT, CENTER, RIGHT)
        self.formula = formula
        self.translated = translate(self.formula)
        self.fmt = fmt
        self.alignment = alignment
        self.reset()

    def reset(self):
        self.value = None

    def recalc(self, rexec):
        if self.value is None:
            try:
                # A hack to evaluate expressions using true division
                rexec.r_exec("from __future__ import division\n" +
                             "__value__ = eval(%s)" % repr(self.translated))
                self.value = rexec.r_eval("__value__")
            except:
                exc = sys.exc_info()[0]
                if hasattr(exc, "__name__"):
                    self.value = exc.__name__
                else:
                    self.value = str(exc)
        return self.value

    def format(self):
        try:
            text = self.fmt % self.value
        except:
            text = str(self.value)
        return text, self.alignment

    def xml(self):
        return '<formula align="%s" format="%s">%s</formula>' % (
            align2xml[self.alignment],
            self.fmt,
            self.formula)

    def renumber(self, x1, y1, x2, y2, dx, dy):
        out = []
        for part in re.split('(\w+)', self.formula):
            m = re.match('^([A-Z]+)([1-9][0-9]*)$', part)
            if m is not None:
                sx, sy = m.groups()
                x = colname2num(sx)
                y = int(sy)
                if x1 <= x <= x2 and y1 <= y <= y2:
                    part = cellname(x+dx, y+dy)
            out.append(part)
        return FormulaCell("".join(out), self.fmt, self.alignment)

def translate(formula):
    """Translate a formula containing fancy cell names to valid Python code.

    Examples:
        B4 -> cell(2, 4)
        B4:Z100 -> cells(2, 4, 26, 100)
    """
    out = []
    for part in re.split(r"(\w+(?::\w+)?)", formula):
        m = re.match(r"^([A-Z]+)([1-9][0-9]*)(?::([A-Z]+)([1-9][0-9]*))?$", part)
        if m is None:
            out.append(part)
        else:
            x1, y1, x2, y2 = m.groups()
            x1 = colname2num(x1)
            if x2 is None:
                s = "cell(%s, %s)" % (x1, y1)
            else:
                x2 = colname2num(x2)
                s = "cells(%s, %s, %s, %s)" % (x1, y1, x2, y2)
            out.append(s)
    return "".join(out)

def cellname(x, y):
    "Translate a cell coordinate to a fancy cell name (e.g. (1, 1)->'A1')."
    assert x > 0 # Column 0 has an empty name, so can't use that
    return colnum2name(x) + str(y)

def colname2num(s):
    "Translate a column name to number (e.g. 'A'->1, 'Z'->26, 'AA'->27)."
    s = s.upper()
    n = 0
    for c in s:
        assert 'A' <= c <= 'Z'
        n = n*26 + ord(c) - ord('A') + 1
    return n

def colnum2name(n):
    "Translate a column number to name (e.g. 1->'A', etc.)."
    assert n > 0
    s = ""
    while n:
        n, m = divmod(n-1, 26)
        s = chr(m+ord('A')) + s
    return s

import Tkinter as Tk

class SheetGUI:

    """Beginnings of a GUI for a spreadsheet.

    TO DO:
    - clear multiple cells
    - Insert, clear, remove rows or columns
    - Show new contents while typing
    - Scroll bars
    - Grow grid when window is grown
    - Proper menus
    - Undo, redo
    - Cut, copy and paste
    - Formatting and alignment
    """

    def __init__(self, filename="sheet1.xml", rows=10, columns=5):
        """Constructor.

        Load the sheet from the filename argument.
        Set up the Tk widget tree.
        """
        # Create and load the sheet
        self.filename = filename
        self.sheet = Sheet()
        if os.path.isfile(filename):
            self.sheet.load(filename)
        # Calculate the needed grid size
        maxx, maxy = self.sheet.getsize()
        rows = max(rows, maxy)
        columns = max(columns, maxx)
        # Create the widgets
        self.root = Tk.Tk()
        self.root.wm_title("Spreadsheet: %s" % self.filename)
        self.beacon = Tk.Label(self.root, text="A1",
                               font=('helvetica', 16, 'bold'))
        self.entry = Tk.Entry(self.root)
        self.savebutton = Tk.Button(self.root, text="Save",
                                    command=self.save)
        self.cellgrid = Tk.Frame(self.root)
        # Configure the widget lay-out
        self.cellgrid.pack(side="bottom", expand=1, fill="both")
        self.beacon.pack(side="left")
        self.savebutton.pack(side="right")
        self.entry.pack(side="left", expand=1, fill="x")
        # Bind some events
        self.entry.bind("<Return>", self.return_event)
        self.entry.bind("<Shift-Return>", self.shift_return_event)
        self.entry.bind("<Tab>", self.tab_event)
        self.entry.bind("<Shift-Tab>", self.shift_tab_event)
        self.entry.bind("<Delete>", self.delete_event)
        self.entry.bind("<Escape>", self.escape_event)
        # Now create the cell grid
        self.makegrid(rows, columns)
        # Select the top-left cell
        self.currentxy = None
        self.cornerxy = None
        self.setcurrent(1, 1)
        # Copy the sheet cells to the GUI cells
        self.sync()

    def delete_event(self, event):
        if self.cornerxy != self.currentxy and self.cornerxy is not None:
            self.sheet.clearcells(*(self.currentxy + self.cornerxy))
        else:
            self.sheet.clearcell(*self.currentxy)
        self.sync()
        self.entry.delete(0, 'end')
        return "break"

    def escape_event(self, event):
        x, y = self.currentxy
        self.load_entry(x, y)

    def load_entry(self, x, y):
        cell = self.sheet.getcell(x, y)
        if cell is None:
            text = ""
        elif isinstance(cell, FormulaCell):
            text = '=' + cell.formula
        else:
            text, alignment = cell.format()
        self.entry.delete(0, 'end')
        self.entry.insert(0, text)
        self.entry.selection_range(0, 'end')

    def makegrid(self, rows, columns):
        """Helper to create the grid of GUI cells.

        The edge (x==0 or y==0) is filled with labels; the rest is real cells.
        """
        self.rows = rows
        self.columns = columns
        self.gridcells = {}
        # Create the top left corner cell (which selects all)
        cell = Tk.Label(self.cellgrid, relief='raised')
        cell.grid_configure(column=0, row=0, sticky='NSWE')
        cell.bind("<ButtonPress-1>", self.selectall)
        # Create the top row of labels, and confiure the grid columns
        for x in range(1, columns+1):
            self.cellgrid.grid_columnconfigure(x, minsize=64)
            cell = Tk.Label(self.cellgrid, text=colnum2name(x), relief='raised')
            cell.grid_configure(column=x, row=0, sticky='WE')
            self.gridcells[x, 0] = cell
            cell.__x = x
            cell.__y = 0
            cell.bind("<ButtonPress-1>", self.selectcolumn)
            cell.bind("<B1-Motion>", self.extendcolumn)
            cell.bind("<ButtonRelease-1>", self.extendcolumn)
            cell.bind("<Shift-Button-1>", self.extendcolumn)
        # Create the leftmost column of labels
        for y in range(1, rows+1):
            cell = Tk.Label(self.cellgrid, text=str(y), relief='raised')
            cell.grid_configure(column=0, row=y, sticky='WE')
            self.gridcells[0, y] = cell
            cell.__x = 0
            cell.__y = y
            cell.bind("<ButtonPress-1>", self.selectrow)
            cell.bind("<B1-Motion>", self.extendrow)
            cell.bind("<ButtonRelease-1>", self.extendrow)
            cell.bind("<Shift-Button-1>", self.extendrow)
        # Create the real cells
        for x in range(1, columns+1):
            for y in range(1, rows+1):
                cell = Tk.Label(self.cellgrid, relief='sunken',
                                bg='white', fg='black')
                cell.grid_configure(column=x, row=y, sticky='NSWE')
                self.gridcells[x, y] = cell
                cell.__x = x
                cell.__y = y
                # Bind mouse events
                cell.bind("<ButtonPress-1>", self.press)
                cell.bind("<B1-Motion>", self.motion)
                cell.bind("<ButtonRelease-1>", self.release)
                cell.bind("<Shift-Button-1>", self.release)

    def selectall(self, event):
        self.setcurrent(1, 1)
        self.setcorner(sys.maxint, sys.maxint)

    def selectcolumn(self, event):
        x, y = self.whichxy(event)
        self.setcurrent(x, 1)
        self.setcorner(x, sys.maxint)

    def extendcolumn(self, event):
        x, y = self.whichxy(event)
        if x > 0:
            self.setcurrent(self.currentxy[0], 1)
            self.setcorner(x, sys.maxint)

    def selectrow(self, event):
        x, y = self.whichxy(event)
        self.setcurrent(1, y)
        self.setcorner(sys.maxint, y)

    def extendrow(self, event):
        x, y = self.whichxy(event)
        if y > 0:
            self.setcurrent(1, self.currentxy[1])
            self.setcorner(sys.maxint, y)

    def press(self, event):
        x, y = self.whichxy(event)
        if x > 0 and y > 0:
            self.setcurrent(x, y)

    def motion(self, event):
        x, y = self.whichxy(event)
        if x > 0 and y > 0:
            self.setcorner(x, y)

    release = motion

    def whichxy(self, event):
        w = self.cellgrid.winfo_containing(event.x_root, event.y_root)
        if w is not None and isinstance(w, Tk.Label):
            try:
                return w.__x, w.__y
            except AttributeError:
                pass
        return 0, 0

    def save(self):
        self.sheet.save(self.filename)

    def setcurrent(self, x, y):
        "Make (x, y) the current cell."
        if self.currentxy is not None:
            self.change_cell()
        self.clearfocus()
        self.beacon['text'] = cellname(x, y)
        self.load_entry(x, y)
        self.entry.focus_set()
        self.currentxy = x, y
        self.cornerxy = None
        gridcell = self.gridcells.get(self.currentxy)
        if gridcell is not None:
            gridcell['bg'] = 'yellow'

    def setcorner(self, x, y):
        if self.currentxy is None or self.currentxy == (x, y):
            self.setcurrent(x, y)
            return
        self.clearfocus()
        self.cornerxy = x, y
        x1, y1 = self.currentxy
        x2, y2 = self.cornerxy or self.currentxy
        if x1 > x2:
            x1, x2 = x2, x1
        if y1 > y2:
            y1, y2 = y2, y1
        for (x, y), cell in self.gridcells.iteritems():
            if x1 <= x <= x2 and y1 <= y <= y2:
                cell['bg'] = 'lightBlue'
        gridcell = self.gridcells.get(self.currentxy)
        if gridcell is not None:
            gridcell['bg'] = 'yellow'
        self.setbeacon(x1, y1, x2, y2)

    def setbeacon(self, x1, y1, x2, y2):
        if x1 == y1 == 1 and x2 == y2 == sys.maxint:
            name = ":"
        elif (x1, x2) == (1, sys.maxint):
            if y1 == y2:
                name = "%d" % y1
            else:
                name = "%d:%d" % (y1, y2)
        elif (y1, y2) == (1, sys.maxint):
            if x1 == x2:
                name = "%s" % colnum2name(x1)
            else:
                name = "%s:%s" % (colnum2name(x1), colnum2name(x2))
        else:
            name1 = cellname(*self.currentxy)
            name2 = cellname(*self.cornerxy)
            name = "%s:%s" % (name1, name2)
        self.beacon['text'] = name


    def clearfocus(self):
        if self.currentxy is not None:
            x1, y1 = self.currentxy
            x2, y2 = self.cornerxy or self.currentxy
            if x1 > x2:
                x1, x2 = x2, x1
            if y1 > y2:
                y1, y2 = y2, y1
            for (x, y), cell in self.gridcells.iteritems():
                if x1 <= x <= x2 and y1 <= y <= y2:
                    cell['bg'] = 'white'

    def return_event(self, event):
        "Callback for the Return key."
        self.change_cell()
        x, y = self.currentxy
        self.setcurrent(x, y+1)
        return "break"

    def shift_return_event(self, event):
        "Callback for the Return key with Shift modifier."
        self.change_cell()
        x, y = self.currentxy
        self.setcurrent(x, max(1, y-1))
        return "break"

    def tab_event(self, event):
        "Callback for the Tab key."
        self.change_cell()
        x, y = self.currentxy
        self.setcurrent(x+1, y)
        return "break"

    def shift_tab_event(self, event):
        "Callback for the Tab key with Shift modifier."
        self.change_cell()
        x, y = self.currentxy
        self.setcurrent(max(1, x-1), y)
        return "break"

    def change_cell(self):
        "Set the current cell from the entry widget."
        x, y = self.currentxy
        text = self.entry.get()
        cell = None
        if text.startswith('='):
            cell = FormulaCell(text[1:])
        else:
            for cls in int, long, float, complex:
                try:
                    value = cls(text)
                except:
                    continue
                else:
                    cell = NumericCell(value)
                    break
        if cell is None and text:
            cell = StringCell(text)
        if cell is None:
            self.sheet.clearcell(x, y)
        else:
            self.sheet.setcell(x, y, cell)
        self.sync()

    def sync(self):
        "Fill the GUI cells from the sheet cells."
        self.sheet.recalc()
        for (x, y), gridcell in self.gridcells.iteritems():
            if x == 0 or y == 0:
                continue
            cell = self.sheet.getcell(x, y)
            if cell is None:
                gridcell['text'] = ""
            else:
                if hasattr(cell, 'format'):
                    text, alignment = cell.format()
                else:
                    text, alignment = str(cell), LEFT
                gridcell['text'] = text
                gridcell['anchor'] = align2anchor[alignment]


def test_basic():
    "Basic non-gui self-test."
    import os
    a = Sheet()
    for x in range(1, 11):
        for y in range(1, 11):
            if x == 1:
                cell = NumericCell(y)
            elif y == 1:
                cell = NumericCell(x)
            else:
                c1 = cellname(x, 1)
                c2 = cellname(1, y)
                formula = "%s*%s" % (c1, c2)
                cell = FormulaCell(formula)
            a.setcell(x, y, cell)
##    if os.path.isfile("sheet1.xml"):
##        print "Loading from sheet1.xml"
##        a.load("sheet1.xml")
    a.display()
    a.save("sheet1.xml")

def test_gui():
    "GUI test."
    if sys.argv[1:]:
        filename = sys.argv[1]
    else:
        filename = "sheet1.xml"
    g = SheetGUI(filename)
    g.root.mainloop()

if __name__ == '__main__':
    #test_basic()
    test_gui()
PK�
Q\�|�D��guido/paint.pycnu�[����
��^c@s`dZddlTdad
\aad�Zd�Zd�Zd�Z	e
dkr\e�nd	S(sA"Paint program by Dave Michell.

Subject: tkinter "paint" example
From: Dave Mitchell <davem@magnet.com>
To: python-list@cwi.nl
Date: Fri, 23 Jan 1998 12:18:05 -0500 (EST)

  Not too long ago (last week maybe?) someone posted a request
for an example of a paint program using Tkinter. Try as I might
I can't seem to find it in the archive, so i'll just post mine
here and hope that the person who requested it sees this!

  All this does is put up a canvas and draw a smooth black line
whenever you have the mouse button down, but hopefully it will
be enough to start with.. It would be easy enough to add some
options like other shapes or colors...

                                                yours,
                                                dave mitchell
                                                davem@magnet.com
i����(t*tupcCs]t�}t|�}|j�|jdt�|jdt�|jdt�|j�dS(Ns<Motion>s<ButtonPress-1>s<ButtonRelease-1>(tTktCanvastpacktbindtmotiontb1downtb1uptmainloop(troottdrawing_area((s0/usr/lib64/python2.7/Demo/tkinter/guido/paint.pytmains	
cCs
dadS(Ntdown(tb1(tevent((s0/usr/lib64/python2.7/Demo/tkinter/guido/paint.pyR'scCsdadadadS(NR(RtNonetxoldtyold(R((s0/usr/lib64/python2.7/Demo/tkinter/guido/paint.pyR,scCsetdkratdk	rLtdk	rL|jjtt|j|jdt�n|ja|jandS(NR
tsmooth(	RRRRtwidgettcreate_linetxtytTRUE(R((s0/usr/lib64/python2.7/Demo/tkinter/guido/paint.pyR2s
(	t__main__N(NN(t__doc__tTkinterRRRRRRRRt__name__(((s0/usr/lib64/python2.7/Demo/tkinter/guido/paint.pyt<module>s
						PK�
Q\.��55guido/svkill.pycnu�[����
Afc@s�ddlTedkr"ed�nddlmZddlmZddlZddlZejdZ	de
fd	��YZd
efd��YZ
edkr�e
dd
d�Zej�jd�ej�jdd�ej�ndS(i����(t*g@s/This version of svkill requires Tk 4.0 or later(tsplitfields(tsplitNtLOGNAMEt	BarButtoncBseZdd�ZRS(cKsOttj||f|�|jdt�t|dd�|_|j|d<dS(Ntsidetnametmenu(tapplyt
Menubuttont__init__tpacktLEFTtMenuR(tselftmastertcnf((s1/usr/lib64/python2.7/Demo/tkinter/guido/svkill.pyR
sN(t__name__t
__module__tNoneR
(((s1/usr/lib64/python2.7/Demo/tkinter/guido/svkill.pyRstKillcBs|eZdddd ded	efgZd!d"d#d$d%d&gZd�Zd�Zd�Zd�Zd�Z	d'd�ZRS((tDefaultts
Every (-e)s-esNon process group leaders (-d)s-dsNon leaders with tty (-a)s-asFor this user (-u %s)s-u %sis	Long (-l)s-lis	Full (-f)s-fisFull Long (-f -l)s-l -fsSession and group ID (-j)s-jsScheduler properties (-c)s-ccCsI|j|jj�d}t|�|}tjd|�|j�dS(Niskill -9 (tformat_listtformattgetRtostsystemt	do_update(Rtselectedtctpid((s1/usr/lib64/python2.7/Demo/tkinter/guido/svkill.pytkill)scCs�|j|jj�d}|j|jj�d}tjd||f�}t|d�}|jj	|dd�|d=|j
jjdt
��x$|D]}|j
jjd|�q�WdS(Nisps %s %ss
is
          (RRRt	view_listtviewtcommandst	getoutputRtheadertsettframetlisttdeletetAtEndtinsert(RRR"tsR(tline((s1/usr/lib64/python2.7/Demo/tkinter/guido/svkill.pyR.s
cCs6|jjdd�|jj|jj|j��dS(Nt0tend(twidgettselect_cleart
select_settnearestty(Rte((s1/usr/lib64/python2.7/Demo/tkinter/guido/svkill.pyt	do_motion8scCs|jjdd�dS(NR.R/(R0R1(RR5((s1/usr/lib64/python2.7/Demo/tkinter/guido/svkill.pytdo_leave;scCs,|j|jj|jj|j���dS(N(R R0RR3R4(RR5((s1/usr/lib64/python2.7/Demo/tkinter/guido/svkill.pytdo_1=scKs�ttj||f|�|jdddt�t|dddtdd�|_|jjdt�t|jd	d
�|j_	|jj	j
jddd
|j�t|jd	d�|j_
t|jd	d�|j_t|�|_
|j
jd�t|�|_|jjd�xatt|j��D]J}|j|\}}|jj
j
jd|d
|jd|j
d|�q*Wxdtt|j��D]M}|j|\}}}|jjj
jd|d
|jd|jd|�q�W|jj|jj	|jj
|jj�t|dtdd�|_|jjdddt�t|�|_t|jdtdtddddd|j�|j_|jjjdtdt �t!|jdt"�|j_#t$|jdt%ddddddddddd t&d!|jj#j�|j_'|jj'j(|jj#d
<|jj#jd"t)dt�|jj'jdddt�t*|d	d#d
|j�|_+|j+jdt�|jj'j,d$|j-�|jj'j,d%|j.�|jj'j,d&|j/�|j�dS('NtexpanditfillRtbartrelieftborderwidthittexttFiletlabeltQuittcommandtViewtFormatitvariabletvaluetanchortfonts*-Courier-Bold-R-Normal-*-120-*ttextvariabletorients!*-Courier-Medium-R-Normal-*-120-*twidthi(theighti
tselectbackgrounds#eed5b7tselectborderwidtht
selectmodetyscrollRtUpdates<Motion>s<Leave>s<1>(0RtFrameR
RtBOTHtRAISEDR;tXRtfileRtadd_commandtquitR"RtIntVarR&trangetlenR!tadd_radiobuttonRRt
tk_menuBarR't	StringVarR%tLabeltFLATtNWR@tYtWt	ScrollbartVERTICALtvscrolltListboxtSUNKENtBROWSER(tyviewtRIGHTtButtontupdatetbindR6R7R8(RRRtnumR@toptiontcol((s1/usr/lib64/python2.7/Demo/tkinter/guido/svkill.pyR
?sv					
	(RR(s
Every (-e)s-e(sNon process group leaders (-d)s-d(sNon leaders with tty (-a)s-a(RRi(s	Long (-l)s-li(s	Full (-f)s-fi(sFull Long (-f -l)s-l -fi(sSession and group ID (-j)s-ji(sScheduler properties (-c)s-ciN(RRtuserR!RR RR6R7R8RR
(((s1/usr/lib64/python2.7/Demo/tkinter/guido/svkill.pyRs"			
			t__main__R=isTkinter Process Killer (SYSV)i(tTkintert	TkVersiontImportErrortstringRRR#RtenvironRrR	RRRRRRR twinfo_toplevelttitletminsizetmainloop(((s1/usr/lib64/python2.7/Demo/tkinter/guido/svkill.pyt<module>s

dPK�
Q\���,�)�)guido/canvasevents.pycnu�[����
Afc@s�ddlTddlmZmZmZdefd��YZddd��YZdefd��YZd	dd
��YZdefd��YZd
efd��YZ	de	fd��YZ
ddd��YZd�Ze
dkr�e�ndS(i����(t*(tOvaltGroupt
CanvasTextRcBseZddd�ZRS(cCs|jj|j||�S(N(tcanvasttag_bindtid(tselftsequencetcommand((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pytbindsN(t__name__t
__module__tNoneR
(((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pyR
stObjectcBsYeZdZddddd�Zd�Zd�Zd�Zd�Zd	�Zd
�Z	RS(s�Base class for composite graphical objects.

    Objects belong to a canvas, and can be moved around on the canvas.
    They also belong to at most one ``pile'' of objects, and can be
    transferred between piles (or removed from their pile).

    Objects have a canonical ``x, y'' position which is moved when the
    object is moved.  Where the object is relative to this position
    depends on the object; for simple objects, it may be their center.

    Objects have mouse sensitivity.  They can be clicked, dragged and
    double-clicked.  The behavior may actually be determined by the pile
    they are in.

    All instance attributes are public since the derived class may
    need them.

    itredtobjectcCsJ||_||_||_d|_t|j�|_|j||�dS(N(RtxtyR
tpileRtgrouptcreateitems(RRRRtfillttext((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pyt__init__#s				cCs
t|j�S(N(tstrR(R((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pyt__str__+sc
Cs�t|j|jd|jd|jd|jdd|dd�|_|jj|j�t|j|j|jd|�|_|jj|j�dS(Nii
RtwidthiR(	RRRRt
_Object__ovalRtaddtag_withtagRt
_Object__text(RRR((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pyR.s	+	cCsW||kodknr dS|jj||�|j||_|j||_dS(Ni(RtmoveRR(Rtdxtdy((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pytmoveby7s
cCs"|j||j||j�dS(N(R"RR(RRR((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pytmoveto>scCsN|jr%|jj|�d|_n||_|jrJ|jj|�ndS(N(RtdeleteR
tadd(RR((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pyttransferAs			cCs|jj�dS(N(Rttkraise(R((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pyR'Is(
RRt__doc__RRRR"R#R&R'(((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pyRs						tBottomcBseZdZd�ZRS(s+An object to serve as the bottom of a pile.c
Gs]t|j|jd|jd|jd|jddddd�|_|jj|j�dS(Nii
Rtgraytoutlinet(RRRRt
_Bottom__ovalRR(Rtargs((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pyRQs	+(RRR(R(((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pyR)MstPilecBsPeZdZdd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
RS(	sA group of graphical objects.cCs~||_||_||_g|_t|j|j|j�|_t|jd|�|_|jj|jj�|j	�dS(Nttag(
RRRtobjectsR)tbottomRRRtbindhandlers(RRRRR0((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pyR\s				cCs0|jjd|j�|jjd|j�dS(Ns<1>s
<Double-1>(RR
tclickhandlertdoubleclickhandler(R((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pyR3fscCs4|jj|�|jj|j�|j|�dS(N(R1tappendRRtposition(RR((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pyR%jscCs'|jj|j�|jj|�dS(N(RtdtagR1tremove(RR((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pyR$oscCsF|j�|jj|�}|j|j|d|j|d�dS(Nii(R'R1tindexR#RR(RRti((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pyR7ss
cCsdS(N((Rtevent((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pyR4xscCsdS(N((RR<((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pyR5{sN(RRR(R
RR3R%R$R7R4R5(((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pyR/Xs
					t
MovingPilecBsAeZd�ZdZd�ZeZd�Zd�Zd�Z	RS(cCs=tj|�|jjd|j�|jjd|j�dS(Ns<B1-Motion>s<ButtonRelease-1>(R/R3RR
t
motionhandlertreleasehandler(R((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pyR3�s
cCs�|jjd�}xMtt|j��D])}|j|}|jj|kr(Pq(q(Wd|_dS|j||_x|jD]}|j	�q|W|j
|_|j|_
dS(Ntcurrent(RtgettagstrangetlenR1RR0R
tmovethisR'RtlastxRtlasty(RR<ttagsR;to((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pyR4�s
	cCsm|js
dS|j|j}|j|j}|j|_|j|_x!|jD]}|j||�qOWdS(N(RDRRERRFR"(RR<R R!RH((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pyR>�s	cCs-|j}|sdSd|_|j|�dS(N(RDR
t
finishmove(RR<R1((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pyR?�s
		cCs"x|D]}|j|�qWdS(N(R7(RR1RH((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pyRI�s
N(
RRR3R
RDR4R5R>R?RI(((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pyR=s			
	tPile1cBs>eZdZdZdZd�Zd�Zd�Zd�ZRS(i2tp1cCs5||_tj||jj|j|j|j�dS(N(tdemoR=RRRRR0(RRL((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pyR�s	cCsMy|jd}Wntk
r%dSX|j|j��tj||�dS(Ni����(R1t
IndexErrorR&totherR=R5(RR<RH((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pyR5�s
cCs
|jjS(N(RLtp2(R((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pyRN�scCs�|d}|j�}|j|j}}||jd||jd||jd||jdkr�x.|D]}|j|�qpWntj||�dS(Nii(RNRRR&R=RI(RR1RHtpRR((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pyRI�s
@
(	RRRRR0RR5RNRI(((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pyRJ�s			tPile2cBs#eZdZdZdZd�ZRS(i�i2ROcCs
|jjS(N(RLRK(R((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pyRN�s(RRRRR0RN(((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pyRQ�stDemocBseZd�ZRS(cCs�||_t|dddddddtdd�|_|jjd	d
dt�t|�|_t|�|_	t
|jddd
d�}t
|jddd
d�}t
|jddd
d�}|j|j�|j|j�|j|j	�dS(NRi�theightt
backgroundtyellowtrelieftborderwidthitexpandiRRRto1tgreento2s
light blueto3(tmastertCanvastSUNKENRtpacktBOTHRJRKRQRORR&(RR]RYR[R\((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pyR�s		(RRR(((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pyRR�scCs6t�}t|�}|jd|j�|j�dS(NtWM_DELETE_WINDOW(tTkRRtprotocoltquittmainloop(trootRL((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pytmain�s	t__main__N((((tTkinterR^RRRRR)R/R=RJRQRRRhR(((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pyt<module>s
?'0
	PK�
Q\-���88guido/AttrDialog.pynu�[���
# The options of a widget are described by the following attributes
# of the Pack and Widget dialogs:
#
# Dialog.current: {name: value}
# -- changes during Widget's lifetime
#
# Dialog.options: {name: (default, klass)}
# -- depends on widget class only
#
# Dialog.classes: {klass: (v0, v1, v2, ...) | 'boolean' | 'other'}
# -- totally static, though different between PackDialog and WidgetDialog
#    (but even that could be unified)

from Tkinter import *

class Option:

    varclass = StringVar            # May be overridden

    def __init__(self, dialog, option):
        self.dialog = dialog
        self.option = option
        self.master = dialog.top
        self.default, self.klass = dialog.options[option]
        self.var = self.varclass(self.master)
        self.frame = Frame(self.master)
        self.frame.pack(fill=X)
        self.label = Label(self.frame, text=(option + ":"))
        self.label.pack(side=LEFT)
        self.update()
        self.addoption()

    def refresh(self):
        self.dialog.refresh()
        self.update()

    def update(self):
        try:
            self.current = self.dialog.current[self.option]
        except KeyError:
            self.current = self.default
        self.var.set(self.current)

    def set(self, e=None):          # Should be overridden
        pass

class BooleanOption(Option):

    varclass = BooleanVar

    def addoption(self):
        self.button = Checkbutton(self.frame,
                                 text='on/off',
                                 onvalue=1,
                                 offvalue=0,
                                 variable=self.var,
                                 relief=RAISED,
                                 borderwidth=2,
                                 command=self.set)
        self.button.pack(side=RIGHT)

class EnumOption(Option):

    def addoption(self):
        self.button = Menubutton(self.frame,
                                 textvariable=self.var,
                                 relief=RAISED, borderwidth=2)
        self.button.pack(side=RIGHT)
        self.menu = Menu(self.button)
        self.button['menu'] = self.menu
        for v in self.dialog.classes[self.klass]:
            self.menu.add_radiobutton(
                label=v,
                variable=self.var,
                value=v,
                command=self.set)

class StringOption(Option):

    def addoption(self):
        self.entry = Entry(self.frame,
                           textvariable=self.var,
                           width=10,
                           relief=SUNKEN,
                           borderwidth=2)
        self.entry.pack(side=RIGHT, fill=X, expand=1)
        self.entry.bind('<Return>', self.set)

class ReadonlyOption(Option):

    def addoption(self):
        self.label = Label(self.frame, textvariable=self.var,
                           anchor=E)
        self.label.pack(side=RIGHT)

class Dialog:

    def __init__(self, master):
        self.master = master
        self.fixclasses()
        self.refresh()
        self.top = Toplevel(self.master)
        self.top.title(self.__class__.__name__)
        self.top.minsize(1, 1)
        self.addchoices()

    def refresh(self): pass         # Must override

    def fixclasses(self): pass      # May override

    def addchoices(self):
        self.choices = {}
        list = []
        for k, dc in self.options.items():
            list.append((k, dc))
        list.sort()
        for k, (d, c) in list:
            try:
                cl = self.classes[c]
            except KeyError:
                cl = 'unknown'
            if type(cl) == TupleType:
                cl = self.enumoption
            elif cl == 'boolean':
                cl = self.booleanoption
            elif cl == 'readonly':
                cl = self.readonlyoption
            else:
                cl = self.stringoption
            self.choices[k] = cl(self, k)

    # Must override:
    options = {}
    classes = {}

    # May override:
    booleanoption = BooleanOption
    stringoption = StringOption
    enumoption = EnumOption
    readonlyoption = ReadonlyOption

class PackDialog(Dialog):

    def __init__(self, widget):
        self.widget = widget
        Dialog.__init__(self, widget)

    def refresh(self):
        self.current = self.widget.info()
        self.current['.class'] = self.widget.winfo_class()
        self.current['.name'] = self.widget._w

    class packoption: # Mix-in class
        def set(self, e=None):
            self.current = self.var.get()
            try:
                apply(self.dialog.widget.pack, (),
                      {self.option: self.current})
            except TclError, msg:
                print msg
                self.refresh()

    class booleanoption(packoption, BooleanOption): pass
    class enumoption(packoption, EnumOption): pass
    class stringoption(packoption, StringOption): pass
    class readonlyoption(packoption, ReadonlyOption): pass

    options = {
            '.class': (None, 'Class'),
            '.name': (None, 'Name'),
            'after': (None, 'Widget'),
            'anchor': ('center', 'Anchor'),
            'before': (None, 'Widget'),
            'expand': ('no', 'Boolean'),
            'fill': ('none', 'Fill'),
            'in': (None, 'Widget'),
            'ipadx': (0, 'Pad'),
            'ipady': (0, 'Pad'),
            'padx': (0, 'Pad'),
            'pady': (0, 'Pad'),
            'side': ('top', 'Side'),
            }

    classes = {
            'Anchor': (N, NE, E, SE, S, SW, W, NW, CENTER),
            'Boolean': 'boolean',
            'Class': 'readonly',
            'Expand': 'boolean',
            'Fill': (NONE, X, Y, BOTH),
            'Name': 'readonly',
            'Pad': 'pixel',
            'Side': (TOP, RIGHT, BOTTOM, LEFT),
            'Widget': 'readonly',
            }

class RemotePackDialog(PackDialog):

    def __init__(self, master, app, widget):
        self.master = master
        self.app = app
        self.widget = widget
        self.refresh()
        self.top = Toplevel(self.master)
        self.top.title(self.app + ' PackDialog')
        self.top.minsize(1, 1)
        self.addchoices()

    def refresh(self):
        try:
            words = self.master.tk.splitlist(
                    self.master.send(self.app,
                                     'pack',
                                     'info',
                                     self.widget))
        except TclError, msg:
            print msg
            return
        dict = {}
        for i in range(0, len(words), 2):
            key = words[i][1:]
            value = words[i+1]
            dict[key] = value
        dict['.class'] = self.master.send(self.app,
                                          'winfo',
                                          'class',
                                          self.widget)
        dict['.name'] = self.widget
        self.current = dict

    class remotepackoption: # Mix-in class
        def set(self, e=None):
            self.current = self.var.get()
            try:
                self.dialog.master.send(
                        self.dialog.app,
                        'pack',
                        'config',
                        self.dialog.widget,
                        '-'+self.option,
                        self.dialog.master.tk.merge(
                                self.current))
            except TclError, msg:
                print msg
                self.refresh()

    class booleanoption(remotepackoption, BooleanOption): pass
    class enumoption(remotepackoption, EnumOption): pass
    class stringoption(remotepackoption, StringOption): pass
    class readonlyoption(remotepackoption, ReadonlyOption): pass

class WidgetDialog(Dialog):

    def __init__(self, widget):
        self.widget = widget
        self.klass = widget.winfo_class()
        Dialog.__init__(self, widget)

    def fixclasses(self):
        if self.addclasses.has_key(self.klass):
            classes = {}
            for c in (self.classes,
                      self.addclasses[self.klass]):
                for k in c.keys():
                    classes[k] = c[k]
            self.classes = classes

    def refresh(self):
        self.configuration = self.widget.config()
        self.update()
        self.current['.class'] = self.widget.winfo_class()
        self.current['.name'] = self.widget._w

    def update(self):
        self.current = {}
        self.options = {}
        for k, v in self.configuration.items():
            if len(v) > 4:
                self.current[k] = v[4]
                self.options[k] = v[3], v[2] # default, klass
        self.options['.class'] = (None, 'Class')
        self.options['.name'] = (None, 'Name')

    class widgetoption: # Mix-in class
        def set(self, e=None):
            self.current = self.var.get()
            try:
                self.dialog.widget[self.option] = self.current
            except TclError, msg:
                print msg
                self.refresh()

    class booleanoption(widgetoption, BooleanOption): pass
    class enumoption(widgetoption, EnumOption): pass
    class stringoption(widgetoption, StringOption): pass
    class readonlyoption(widgetoption, ReadonlyOption): pass

    # Universal classes
    classes = {
            'Anchor': (N, NE, E, SE, S, SW, W, NW, CENTER),
            'Aspect': 'integer',
            'Background': 'color',
            'Bitmap': 'bitmap',
            'BorderWidth': 'pixel',
            'Class': 'readonly',
            'CloseEnough': 'double',
            'Command': 'command',
            'Confine': 'boolean',
            'Cursor': 'cursor',
            'CursorWidth': 'pixel',
            'DisabledForeground': 'color',
            'ExportSelection': 'boolean',
            'Font': 'font',
            'Foreground': 'color',
            'From': 'integer',
            'Geometry': 'geometry',
            'Height': 'pixel',
            'InsertWidth': 'time',
            'Justify': (LEFT, CENTER, RIGHT),
            'Label': 'string',
            'Length': 'pixel',
            'MenuName': 'widget',
            'Name': 'readonly',
            'OffTime': 'time',
            'OnTime': 'time',
            'Orient': (HORIZONTAL, VERTICAL),
            'Pad': 'pixel',
            'Relief': (RAISED, SUNKEN, FLAT, RIDGE, GROOVE),
            'RepeatDelay': 'time',
            'RepeatInterval': 'time',
            'ScrollCommand': 'command',
            'ScrollIncrement': 'pixel',
            'ScrollRegion': 'rectangle',
            'ShowValue': 'boolean',
            'SetGrid': 'boolean',
            'Sliderforeground': 'color',
            'SliderLength': 'pixel',
            'Text': 'string',
            'TickInterval': 'integer',
            'To': 'integer',
            'Underline': 'index',
            'Variable': 'variable',
            'Value': 'string',
            'Width': 'pixel',
            'Wrap': (NONE, CHAR, WORD),
            }

    # Classes that (may) differ per widget type
    _tristate = {'State': (NORMAL, ACTIVE, DISABLED)}
    _bistate = {'State': (NORMAL, DISABLED)}
    addclasses = {
            'Button': _tristate,
            'Radiobutton': _tristate,
            'Checkbutton': _tristate,
            'Entry': _bistate,
            'Text': _bistate,
            'Menubutton': _tristate,
            'Slider': _bistate,
            }

class RemoteWidgetDialog(WidgetDialog):

    def __init__(self, master, app, widget):
        self.app = app
        self.widget = widget
        self.klass = master.send(self.app,
                                 'winfo',
                                 'class',
                                 self.widget)
        Dialog.__init__(self, master)

    def refresh(self):
        try:
            items = self.master.tk.splitlist(
                    self.master.send(self.app,
                                     self.widget,
                                     'config'))
        except TclError, msg:
            print msg
            return
        dict = {}
        for item in items:
            words = self.master.tk.splitlist(item)
            key = words[0][1:]
            value = (key,) + words[1:]
            dict[key] = value
        self.configuration = dict
        self.update()
        self.current['.class'] = self.klass
        self.current['.name'] = self.widget

    class remotewidgetoption: # Mix-in class
        def set(self, e=None):
            self.current = self.var.get()
            try:
                self.dialog.master.send(
                        self.dialog.app,
                        self.dialog.widget,
                        'config',
                        '-'+self.option,
                        self.current)
            except TclError, msg:
                print msg
                self.refresh()

    class booleanoption(remotewidgetoption, BooleanOption): pass
    class enumoption(remotewidgetoption, EnumOption): pass
    class stringoption(remotewidgetoption, StringOption): pass
    class readonlyoption(remotewidgetoption, ReadonlyOption): pass

def test():
    import sys
    root = Tk()
    root.minsize(1, 1)
    if sys.argv[1:]:
        remotetest(root, sys.argv[1])
    else:
        frame = Frame(root, name='frame')
        frame.pack(expand=1, fill=BOTH)
        button = Button(frame, name='button', text='button')
        button.pack(expand=1)
        canvas = Canvas(frame, name='canvas')
        canvas.pack()
        fpd = PackDialog(frame)
        fwd = WidgetDialog(frame)
        bpd = PackDialog(button)
        bwd = WidgetDialog(button)
        cpd = PackDialog(canvas)
        cwd = WidgetDialog(canvas)
    root.mainloop()

def remotetest(root, app):
    from listtree import listtree
    list = listtree(root, app)
    list.bind('<Any-Double-1>', opendialogs)
    list.app = app                  # Pass it on to handler

def opendialogs(e):
    import string
    list = e.widget
    sel = list.curselection()
    for i in sel:
        item = list.get(i)
        widget = string.split(item)[0]
        RemoteWidgetDialog(list, list.app, widget)
        if widget == '.': continue
        try:
            RemotePackDialog(list, list.app, widget)
        except TclError, msg:
            print msg

test()
PK�
Q\�˗*KKguido/hello.pynu�[���# Display hello, world in a button; clicking it quits the program

import sys
from Tkinter import *

def main():
    root = Tk()
    button = Button(root)
    button['text'] = 'Hello, world'
    button['command'] = quit_callback       # See below
    button.pack()
    root.mainloop()

def quit_callback():
    sys.exit(0)

main()
PK�
Q\qf�XXguido/newmenubardemo.pycnu�[����
Afc@sFdZddlTddd��YZd�ZedkrBe�ndS(	s.Play with the new Tk 8.0 toplevel menu option.i����(t*tAppcBseZd�ZRS(cCsu||_t|j�|_t|j�|_|jjdd�|jjdd�|jjdd�|jj�|jjddd|jj�t|j�|_|jjdd�|jjdd�|jjdd	�t|jd
d�|_|jjdd�|jj	dd
d|j�|jj	ddd|j�|jj	ddd|j�t
d|j�|_dS(NtlabeltNewsOpen...tClosetQuittcommandtCuttCopytPastetnamethelpsAbout...tFiletmenutEdittHelp(tmastertMenutmenubartfilemenutadd_commandt
add_separatortquitteditmenuthelpmenutadd_cascadetToplevelttop(tselfR((s9/usr/lib64/python2.7/Demo/tkinter/guido/newmenubardemo.pyt__init__	s$	
(t__name__t
__module__R(((s9/usr/lib64/python2.7/Demo/tkinter/guido/newmenubardemo.pyRscCs-t�}|j�t|�}|j�dS(N(tTktwithdrawRtmainloop(troottapp((s9/usr/lib64/python2.7/Demo/tkinter/guido/newmenubardemo.pytmain(s	
t__main__N((t__doc__tTkinterRR%R(((s9/usr/lib64/python2.7/Demo/tkinter/guido/newmenubardemo.pyt<module>s

!	PK�
Q\����YYguido/brownian.pycnu�[����
��^c@s�ddlTddlZddlZddlZddlZdZdZdZdZdZ	dZ
dZdad	�Z
d
�Ze�dS(i����(t*Ni�i,i
itredicCs�t}tjtdt�}tjtdt�}|j||||||||dt�}xvts�tjdt	�}tjdt	�}tj
t�}y|j|||�Wnt
k
r�PnXtj|�qcWdS(Ng@tfilli(tRADIUStrandomtgausstWIDTHtSIGMAtHEIGHTtcreate_ovaltFILLtstoptBUZZtexpovariatetLAMBDAtmovetTclErrorttimetsleep(tcanvastrtxtytptdxtdytdt((s3/usr/lib64/python2.7/Demo/tkinter/guido/brownian.pytparticles.	
cCs�t�}t|dtdt�}|jdddd�d}tjdr`ttjd�}nx9t|�D]+}t	j
dtd	|f�}|j�qmWz|j
�WddaXdS(
NtwidththeightRtbothtexpandiittargettargs(tTktCanvasRRtpacktsystargvtinttranget	threadingtThreadRtstarttmainloopR(trootRtnptitt((s3/usr/lib64/python2.7/Demo/tkinter/guido/brownian.pytmain"s	
(tTkinterRR)RR%RRRRRRR
RRR1(((s3/usr/lib64/python2.7/Demo/tkinter/guido/brownian.pyt<module>s
		PK�
Q\%L��guido/brownian2.pyonu�[����
��^c@s�ddlTddlZddlZdZdZdZdZdZdZdZ	da
dad	�Z
d
�Zd�Zedkr�e�ndS(
i����(t*Ni�i,i
itrediccs�t}tjtdt�}tjtdt�}|j||||||||dt�}x_ts�tjdt	�}tjdt	�}y|j
|||�Wntk
r�PqcXdVqcWdS(Ng@tfilli(
tRADIUStrandomtgausstWIDTHtSIGMAtHEIGHTtcreate_ovaltFILLtstoptBUZZtmovetTclErrortNone(tcanvastrtxtytptdxtdy((s4/usr/lib64/python2.7/Demo/tkinter/guido/brownian2.pytparticles.	
cCs:|j�tjt�}tjt|d�t|�dS(Ni�(tnextRtexpovariatetLAMBDAtroottaftertintR
(Rtdt((s4/usr/lib64/python2.7/Demo/tkinter/guido/brownian2.pyR
"s
cCs�t�attdtdt�}|jdddd�d}tjdr`ttjd�}nx$t	|�D]}t
t|��qmWztj�Wdda
XdS(NtwidththeightRtbothtexpandii(tTkRtCanvasRRtpacktsystargvRtrangeR
RtmainloopR(Rtnpti((s4/usr/lib64/python2.7/Demo/tkinter/guido/brownian2.pytmain's	
t__main__(tTkinterRR&RRRRRRR
RRRRR
R,t__name__(((s4/usr/lib64/python2.7/Demo/tkinter/guido/brownian2.pyt<module>s 
			PK�
Q\�Ṁ��guido/dialog.pynuȯ��#! /usr/bin/python2.7

# A Python function that generates dialog boxes with a text message,
# optional bitmap, and any number of buttons.
# Cf. Ousterhout, Tcl and the Tk Toolkit, Figs. 27.2-3, pp. 269-270.

from Tkinter import *
import sys


def dialog(master, title, text, bitmap, default, *args):

    # 1. Create the top-level window and divide it into top
    # and bottom parts.

    w = Toplevel(master, class_='Dialog')
    w.title(title)
    w.iconname('Dialog')

    top = Frame(w, relief=RAISED, borderwidth=1)
    top.pack(side=TOP, fill=BOTH)
    bot = Frame(w, relief=RAISED, borderwidth=1)
    bot.pack(side=BOTTOM, fill=BOTH)

    # 2. Fill the top part with the bitmap and message.

    msg = Message(top, width='3i', text=text,
                  font='-Adobe-Times-Medium-R-Normal-*-180-*')
    msg.pack(side=RIGHT, expand=1, fill=BOTH, padx='3m', pady='3m')
    if bitmap:
        bm = Label(top, bitmap=bitmap)
        bm.pack(side=LEFT, padx='3m', pady='3m')

    # 3. Create a row of buttons at the bottom of the dialog.

    var = IntVar()
    buttons = []
    i = 0
    for but in args:
        b = Button(bot, text=but, command=lambda v=var,i=i: v.set(i))
        buttons.append(b)
        if i == default:
            bd = Frame(bot, relief=SUNKEN, borderwidth=1)
            bd.pack(side=LEFT, expand=1, padx='3m', pady='2m')
            b.lift()
            b.pack (in_=bd, side=LEFT,
                    padx='2m', pady='2m', ipadx='2m', ipady='1m')
        else:
            b.pack (side=LEFT, expand=1,
                    padx='3m', pady='3m', ipadx='2m', ipady='1m')
        i = i+1

    # 4. Set up a binding for <Return>, if there's a default,
    # set a grab, and claim the focus too.

    if default >= 0:
        w.bind('<Return>',
               lambda e, b=buttons[default], v=var, i=default:
               (b.flash(),
                v.set(i)))

    oldFocus = w.focus_get()
    w.grab_set()
    w.focus_set()

    # 5. Wait for the user to respond, then restore the focus
    # and return the index of the selected button.

    w.waitvar(var)
    w.destroy()
    if oldFocus: oldFocus.focus_set()
    return var.get()

# The rest is the test program.

def go():
    i = dialog(mainWidget,
               'Not Responding',
               "The file server isn't responding right now; "
               "I'll keep trying.",
               '',
               -1,
               'OK')
    print 'pressed button', i
    i = dialog(mainWidget,
               'File Modified',
               'File "tcl.h" has been modified since '
               'the last time it was saved. '
               'Do you want to save it before exiting the application?',
               'warning',
               0,
               'Save File',
               'Discard Changes',
               'Return To Editor')
    print 'pressed button', i

def test():
    import sys
    global mainWidget
    mainWidget = Frame()
    Pack.config(mainWidget)
    start = Button(mainWidget, text='Press Here To Start', command=go)
    start.pack()
    endit = Button(mainWidget, text="Exit", command=sys.exit)
    endit.pack(fill=BOTH)
    mainWidget.mainloop()

if __name__ == '__main__':
    test()
PK�
Q\KѴ�Q�Qguido/solitaire.pyonu�[����
Afc@sCdZddlZddlZddlTddlmZmZmZmZdefd��YZdZ	dZ
d	Ze	d
eZe
deZ
dZd
ZdZdZdZdZdZdZiZxeefD]Zeee<q�WxeefD]Zeee<q�Wej�Zee�ZdZdZdZdZe dd�Z!ee!�Z"ddge#e$e d
d��dddgZ%dZ&dd0d ��YZ'd!d1d"��YZ(d#e(fd$��YZ)d%�Z*d&e(fd'��YZ+d(e+fd)��YZ,d*e+fd+��YZ-d,d2d-��YZ.d.�Z/e0d/kr?e/�ndS(3s�Solitaire game, much like the one that comes with MS Windows.

Limitations:

- No cute graphical images for the playing cards faces or backs.
- No scoring or timer.
- No undo.
- No option to turn 3 cards at a time.
- No keyboard shortcuts.
- Less fancy animation when you win.
- The determination of which stack you drag to is more relaxed.

Apology:

I'm not much of a card player, so my terminology in these comments may
at times be a little unusual.  If you have suggestions, please let me
know!

i����N(t*(t	Rectanglet
CanvasTexttGrouptWindowRcBseZddd�ZRS(cCs|jj|j||�S(N(tcanvasttag_bindtid(tselftsequencetcommand((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pytbind%sN(t__name__t
__module__tNoneR(((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyR$sidi�i
iiis#070tHearttDiamondtClubtSpadetredtblackiiii
ittAtJtQtKitCardcBsMeZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	RS(s�A playing card.

    A card doesn't record to which stack it belongs; only the stack
    records this (it turns out that we always know this from the
    context, and this saves a ``double update'' with potential for
    inconsistencies).

    Public methods:

    moveto(x, y) -- move the card to an absolute position
    moveby(dx, dy) -- move the card by a relative offset
    tkraise() -- raise the card to the top of its stack
    showface(), showback() -- turn the card face up or down & raise it

    Public read-only instance variables:

    suit, value, color -- the card's suit, value and color
    face_shown -- true when the card is shown face up, else false

    Semi-public read-only instance variables (XXX should be made
    private):

    group -- the Canvas.Group representing the card
    x, y -- the position of the card's top left corner

    Private instance variables:

    __back, __rect, __text -- the canvas items making up the card

    (To show the card face up, the text item is placed in front of
    rect and the back is placed behind it.  To show it face down, this
    is reversed.  The card is created face down.)

    c
Cs||_||_t||_d|_d|_|_t|�|_dt	||f}t
|tdddtd|jd|�|_
|jj|j
�t|ddttdddd	�|_|jj|j�t|ttttttdddd
�|_|jj|j�dS(sCard constructor.

        Arguments are the card's suit and value, and the canvas widget.

        The card is created at position (0, 0), with its face down
        (adding it to a stack will position it according to that
        stack's rules).

        is%s  %sitanchortfillttexttoutlineRtwhitetblueN(tsuittvaluetCOLORtcolort
face_showntxtyRtgrouptVALNAMESRt	CARDWIDTHtNt_Card__texttaddtag_withtagRt
CARDHEIGHTt_Card__recttMARGINt_Card__back(RR!R"RR((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyt__init__�s"
		
	cCsd|j|jfS(s+Return a string for debug print statements.sCard(%r, %r)(R!R"(R((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyt__repr__�scCs"|j||j||j�dS(s*Move the card to absolute position (x, y).N(tmovebyR&R'(RR&R'((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pytmoveto�scCs7|j||_|j||_|jj||�dS(sMove the card by (dx, dy).N(R&R'R(tmove(Rtdxtdy((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyR4�scCs|jj�dS(s5Raise the card above all other objects in its canvas.N(R(ttkraise(R((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyR9�scCs1|j�|jj�|jj�d|_dS(sTurn the card's face up.iN(R9R/R,R%(R((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pytshowface�s


cCs1|j�|jj�|jj�d|_dS(sTurn the card's face down.iN(R9R/R1R%(R((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pytshowback�s


(
RR
t__doc__R2R3R5R4R9R:R;(((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRss#	 					tStackcBs�eZdZdd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
d�Zd�Zd
�Zd�Zd�ZdZd�Zd�Zd�ZRS(s�A generic stack of cards.

    This is used as a base class for all other stacks (e.g. the deck,
    the suit stacks, and the row stacks).

    Public methods:

    add(card) -- add a card to the stack
    delete(card) -- delete a card from the stack
    showtop() -- show the top card (if any) face up
    deal() -- delete and return the top card, or None if empty

    Method that subclasses may override:

    position(card) -- move the card to its proper (x, y) position

        The default position() method places all cards at the stack's
        own (x, y) position.

    userclickhandler(), userdoubleclickhandler() -- called to do
    subclass specific things on single and double clicks

        The default user (single) click handler shows the top card
        face up.  The default user double click handler calls the user
        single click handler.

    usermovehandler(cards) -- called to complete a subpile move

        The default user move handler moves all moved cards back to
        their original position (by calling the position() method).

    Private methods:

    clickhandler(event), doubleclickhandler(event),
    motionhandler(event), releasehandler(event) -- event handlers

        The default event handlers turn the top card of the stack with
        its face up on a (single or double) click, and also support
        moving a subpile around.

    startmoving(event) -- begin a move operation
    finishmoving() -- finish a move operation

    cCs�||_||_||_g|_t|jj�|_|jjd|j�|jjd|j	�|jjd|j
�|jjd|j�|j�dS(sStack constructor.

        Arguments are the stack's nominal x and y position (the top
        left corner of the first card placed in the stack), and the
        game object (which is used to get the canvas; subclasses use
        the game object to find other stacks).

        s<1>s
<Double-1>s<B1-Motion>s<ButtonRelease-1>N(
R&R'tgametcardsRRR(Rtclickhandlertdoubleclickhandlert
motionhandlertreleasehandlert
makebottom(RR&R'R>((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyR2s					cCsdS(N((R((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRDscCsd|jj|j|jfS(s+Return a string for debug print statements.s
%s(%d, %d)(t	__class__RR&R'(R((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyR3scCs>|jj|�|j�|j|�|jj|j�dS(N(R?tappendR9tpositionR(R-(Rtcard((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pytadd%s

cCs'|jj|�|jj|j�dS(N(R?tremoveR(tdtag(RRH((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pytdelete+scCs!|jr|jdj�ndS(Ni����(R?R:(R((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pytshowtop/s	cCs+|js
dS|jd}|j|�|S(Ni����(R?RRL(RRH((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pytdeal3s
	

cCs|j|j|j�dS(N(R5R&R'(RRH((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRG<scCs|j�dS(N(RM(R((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pytuserclickhandler?scCs|j�dS(N(RO(R((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pytuserdoubleclickhandlerBscCs"x|D]}|j|�qWdS(N(RG(RR?RH((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pytusermovehandlerEs
cCs%|j�|j�|j|�dS(N(tfinishmovingROtstartmoving(Rtevent((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyR@Ks

cCs|j|�dS(N(t
keepmoving(RRT((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRBPscCs|j|�|j�dS(N(RURR(RRT((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRCSs
cCs%|j�|j�|j|�dS(N(RRRPRS(RRT((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRAWs

cCs�d|_|jjjd�}xDtt|j��D])}|j|}|jj	|kr4Pq4q4WdS|j
srdS|j||_|j|_|j
|_x|jD]}|j�q�WdS(Ntcurrent(RtmovingR>RtgettagstrangetlenR?R(ttagR%R&tlastxR'tlastyR9(RRTttagstiRH((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRS`s	
	cCs||js
dS|j|j}|j|j}|j|_|j|_|sQ|rxx$|jD]}|j||�q[WndS(N(RWR&R\R'R]R4(RRTR7R8RH((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRUqs	cCs,|j}d|_|r(|j|�ndS(N(RWRRQ(RR?((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRR|s		N(RR
R<RR2RDR3RIRLRMRNRGRORPRQR@RBRCRARWRSRURR(((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyR=�s(-																	tDeckcBs2eZdZd�Zd�Zd�Zd�ZRS(s7The deck is a stack with support for shuffling.

    New methods:

    fill() -- create the playing cards
    shuffle() -- shuffle the playing cards

    A single click moves the top card to the game's open deck and
    moves it face up; if we're out of cards, it moves the open deck
    back to the deck.

    c
CsRt|jj|j|j|jt|jtdddt�}|jj	|�dS(NRRR(
RR>RR&R'R*R.t
BACKGROUNDR(R-(Rtbottom((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRD�s
cCsEx>tD]6}x-tD]%}|jt|||jj��qWqWdS(N(tALLSUITSt	ALLVALUESRIRR>R(RR!R"((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyR�s

cCsMt|j�}g}x(t|�D]}|j|j|�q"W||_dS(N(RZR?trandpermRF(RtntnewcardsR_((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pytshuffle�s
cCsv|jj}|j�}|sUxQ|j�}|s7Pn|j|�|j�q!Wn|jjj|�|j�dS(N(R>topendeckRNRIR;R:(RRiRH((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRO�s
(RR
R<RDRRhRO(((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyR`�s

			cCsLt|�}g}x3|rGtj|�}|j|�|j|�qW|S(s4Function returning a random permutation of range(n).(RYtrandomtchoiceRFRJ(RftrR&R_((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRe�s	
t	OpenStackcBs#eZd�Zd�Zd�ZRS(cCsdS(Ni((RR?((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyt
acceptable�scCs�|d}|jj|�}|s?||ks?|j|�rRtj||�n8x(|D] }|j|�|j|�qYW|jj�dS(Ni(R>tcloseststackRnR=RQRLRItwincheck(RR?RHtstack((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRQ�s
#

cCs�|js
dS|jd}|js1|j�dSxQ|jjD]C}|j|g�r>|j|�|j|�|jj�Pq>q>WdS(Ni����(	R?R%ROR>tsuitsRnRLRIRp(RRHts((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRP�s	
	



(RR
RnRQRP(((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRm�s		t	SuitStackcBs,eZd�Zd�Zd�Zd�ZRS(c
CsBt|jj|j|j|jt|jtdddd�}dS(NRRRR(RR>RR&R'R*R.(RRb((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRD�scCsdS(N((R((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRO�scCsdS(N((R((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRP�scCsit|�dkrdS|d}|js6|jtkS|jd}|j|jkoh|j|jdkS(Niii����(RZR?R"tACER!(RR?RHttopcard((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRn�s
	

(RR
RDRORPRn(((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRt�s			tRowStackcBseZd�Zd�ZRS(cCs`|d}|js |jtkS|jd}|js:dS|j|jko_|j|jdkS(Nii����i(R?R"tKINGR%R$(RR?RHRv((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRn�s
	

	cCsh|j}xE|jD]:}||kr)Pn|jrC|dt}q|t}qW|j|j|�dS(Ni(R'R?R%R0tOFFSETR5R&(RRHR'tc((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRGs		(RR
RnRG(((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRw�s		t	SolitairecBsGeZd�Zd�Zd�Zd�Zd�Zd�Zd�ZRS(cCs�||_t|jdtdddttddtdt�|_|jjdt	d	t
�t|jd
ddddtdd
d|j�|_
t|jtdtdd|j
dt�t}t}t|||�|_|t}t|||�|_|t}g|_x:tt�D],}|t}|jjt|||��qWt}|t}g|_x:tt�D],}|jjt|||��|t}qoW|jg|j|j|_|jj�|j�dS(Nt
backgroundthighlightthicknessitwidththeightiiRtexpandRtDealtactivebackgroundtgreenR
twindowR(tmastertCanvasRatNROWStXSPACINGtYSPACINGR0RtpacktBOTHtTRUEtButtonRNt
dealbuttonRtSWR`tdeckRmRiRrRYtNSUITSRFRttrowsRwt
openstacksR(RR�R&R'R_((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyR2sD	


	
 
	
cCsEx*|jD]}t|j�tkr
dSq
W|j�|j�dS(N(RrRZR?tNVALUEStwinRN(RRs((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRp=s

cCsgg}x|jD]}||j}qWx9|rbtj|�}|j|�|j||j�q*WdS(sStupid animation when you win.N(R�R?RjRkRJtanimatedmovetoR�(RR?RsRH((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyR�Ds	
cCsgx`tddd�D]L}|j|j||j|j|}}|j||�|jj�qWdS(Ni
ii����(RYR&R'R4R�tupdate_idletasks(RRHtdestR_R7R8((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyR�Ns)cCsed}d}xR|jD]G}|j|jd|j|jd}||kr|}|}qqW|S(Ni�ɚ;i(RR�R&R'(RRHtclosesttcdistRqtdist((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRoTs&
cCs�|j�|jj�xHtt�D]:}x1|j|D]"}|jj�}|j|�q8Wq$Wx|jD]}|j�qlWdS(N(	tresetR�RhRYR�R�RNRIRM(RR_RlRH((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRN`s

cCsOxH|jD]=}x4|j�}|s)Pn|jj|�|j�qWq
WdS(N(R�RNR�RIR;(RRqRH((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyR�js(	RR
R2RpR�R�RoRNR�(((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyR{
s	.		
			
cCs6t�}t|�}|jd|j�|j�dS(NtWM_DELETE_WINDOW(tTkR{tprotocoltquittmainloop(trootR>((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pytmainvs	t__main__((((1R<tmathRjtTkinterR�RRRRR*R.R0R�R�RyRatHEARTStDIAMONDStCLUBStSPADEStREDtBLACKR#RstkeysRcRZR�RutJACKtQUEENRxRYRdR�tmaptstrR)R�RR=R`ReRmRtRwR{R�R(((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyt<module>sX
"
/f�1	i	PK�
Q\��sl�~�~
guido/ss1.pycnu�[����
��^c@s�dZddlZddlZddlZddlZddlZddlmZdddf\ZZ	Z
d�Zd�Zd	�Z
iee6ee	6e
e
6Zid
e6de	6de
6Zied
6e	d6e
d6Zid
e6de	6de
6Zd�Zdfd��YZdfd��YZdfd��YZdefd��YZdefd��YZdefd��YZd�Zd�Zd�Zd�ZddlZd fd!��YZd"�Z d#�Z!e"d$kr�e!�ndS(%sSS1 -- a spreadsheet.i����N(texpattLEFTtCENTERtRIGHTcCs
|j|�S(N(tljust(txtn((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRscCs
|j|�S(N(tcenter(RR((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRscCs
|j|�S(N(trjust(RR((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRstleftRtrighttwtecCs4d}x'|D]}|dk	r
||7}q
q
W|S(Ni(tNone(tseqttotalR((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pytsums

tSheetcBs�eZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�ZRS(cCsOi|_tj�|_|jjd�}|j|_|j|_t|_dS(Nt__main__(tcellstrexectRExect
add_modulet	cellvaluetcelltmulticellvalueR(tselftm((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt__init__"s	cCs9|j||�}t|d�r1|j|j�S|SdS(Ntrecalc(tgetcellthasattrRR(RRtyR((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR*scCs�||kr||}}n||kr8||}}ng}xRt||d�D]=}x4t||d�D]}|j|j||��qlWqRW|S(Ni(trangetappendR(Rtx1ty1tx2ty2RR R((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR1s!cCs|jj||f�S(N(Rtget(RRR ((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR<scCsJ|dkr|dkst�t|t�s3t�||j||f<dS(Ni(tAssertionErrort
isinstancetBaseCellR(RRR R((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pytsetcell?scCs,y|j||f=Wntk
r'nXdS(N(RtKeyError(RRR ((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt	clearcellDs
cCs1x*|j||||�D]}|j|=qWdS(N(tselectcellsR(RR#R$R%R&txy((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt
clearcellsJscCs|jd|tj|�dS(Ni(R0tsystmaxint(RR$R&((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt	clearrowsNscCs|j|d|tj�dS(Ni(R0R1R2(RR#R%((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pytclearcolumnsQscCs�||kr||}}n||kr8||}}ng|jD]P\}}||koe|knrB||ko�|knrB||f^qBS(N(R(RR#R$R%R&RR ((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR.TscCsI|dkr|dkrdS||kr8||}}n||krT||}}n||dkrt||dkszt�i}x�|jD]�\}}	|j||	f}
t|
d�r�|
j||||||�}
n||ko�|knr(||	ko|knr(||7}|	|7}	n|
|||	f<q�W||_dS(Nitrenumber(R(RRR5(RR#R$R%R&tdxtdytnewRR R((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt	movecells\s"&!8

cCs8|dkst�|jd|tjtjd|�dS(Ni(R(R9R1R2(RR R((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt
insertrowsoscCs^||kr||}}n|j||�|jd|dtjtjd||d�dS(Nii(R3R9R1R2(RR$R&((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt
deleterowssscCs8|dkst�|j|dtjtj|d�dS(Ni(R(R9R1R2(RRR((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt
insertcolumnsyscCs^||kr||}}n|j||�|j|ddtjtj||dd�dS(Nii(R0R9R1R2(RR#R%((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt
deletecolumns}scCsLd}}x5|jD]*\}}t||�}t||�}qW||fS(Ni(Rtmax(RtmaxxtmaxyRR ((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pytgetsize�s

cCs:x3|jj�D]"}t|d�r|j�qqWdS(Ntreset(Rt
itervaluesRRB(RR((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRB�scCsJ|j�x9|jj�D](}t|d�r|j|j�qqWdS(NR(RBRRCRRR(RR((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR�s
cCs�|j�\}}|d|d}}dg|}i}xZtd|�D]I}t|�tf||df<\}}	t||t|��||<qJWxZtd|�D]I}
t|
�tf|d|
f<\}}	t|dt|��|d<q�Wx|jj�D]\\}}
}|dks|
dkr4qnt	|d�rV|j
|j�nt	|d�r�|j�\}}	t
|t�s�t�|	tttfks�t�n*t|�}t
|t�r�t}	nt}	||	f|||
f<t||t|��||<qWd}x9t|�D]+}|r7|d7}n|d||7}qWx�t|�D]�}
d}
xot|�D]a}|j||
f�p�dtf\}}	t|	|||�}|
r�|
d7}
n|
|7}
qsW|
GH|
dkrZ|GHqZqZWdS(	NiiRtformattt+t-t|(RAR!tcolnum2nameRR>tlentstrRt	iteritemsRRRRDR)R(RRR'talign2action(RR?R@twidththeighttcolwidthtfullRttextt	alignmentR Rtseptline((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pytdisplay�sR
&!&!"	!
'
cCs�dg}xn|jj�D]]\\}}}t|d�rI|j�}ndtj|�}|jd|||f�qW|jd�dj|�S(Ns
<spreadsheet>txmls<value>%s</value>s%<cell row="%s" col="%s">
  %s
</cell>s</spreadsheet>s
(RRLRRWtcgitescapeR"tjoin(RtoutRR Rtcellxml((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRW�s	"	
cCs\|j�}t|d�}|j|�|rN|jd�rN|jd�n|j�dS(NRs
(RWtopentwritetendswithtclose(RtfilenameRRtf((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pytsave�s
cCs0t|d�}t|�j|�|j�dS(Ntr(R]tSheetParsert	parsefileR`(RRaRb((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pytload�s(t__name__t
__module__RRRRR+R-R0R3R4R.R9R:R;R<R=RARBRRVRWRcRg(((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR s,																			2		RecBs�eZd�Zd�Zd�Zd�Zd�Zd�Zd�ZeZ	d�Z
d�Zd	�Zd
�Z
d�Zd�Zd
�Zd�ZRS(cCs
||_dS(N(tsheet(RRj((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR�scCsAtj�}|j|_|j|_|j|_|j|�dS(N(	RtParserCreatetstartelementtStartElementHandlert
endelementtEndElementHandlertdatatCharacterDataHandlert	ParseFile(RRbtparser((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRf�s
cCsct|d|d�}|rVx*|j�D]\}}t|�||<q)W||�ng|_dS(Ntstart_(tgetattrR
RLRKttexts(Rttagtattrstmethodtkeytvalue((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRl�s
cCs t|�}|jj|�dS(N(RKRvR"(RRR((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRp�scCs9t|d|d�}|r5|dj|j��ndS(Ntend_RE(RuR
RZRv(RRwRy((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRn�scCs4t|jd��|_t|jd��|_dS(Ntrowtcol(tintR'R R(RRx((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt
start_cell�scCs1|jd�|_tj|jd��|_dS(NRDtalign(R'tfmtt	xml2alignRS(RRx((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pytstart_valuescCs*yt|�|_Wnd|_nXdS(N(RR{R
(RRR((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pytend_intscCs*yt|�|_Wnd|_nXdS(N(tlongR{R
(RRR((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pytend_long
scCs*yt|�|_Wnd|_nXdS(N(tfloatR{R
(RRR((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt
end_doublescCs*yt|�|_Wnd|_nXdS(N(tcomplexR{R
(RRR((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pytend_complexscCs$y
||_Wnd|_nXdS(N(R{R
(RRR((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt
end_strings
cCs�t|jt�r!|j|_nit|jt�r`t|j|jpHd|jpTt�|_n*t	|j|jpud|jp�t
�|_dS(Ns%s(R)R{R*RRKt
StringCellR�RSRtNumericCellR(RRR((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt	end_value%s		cCs+t||jpd|jpt�|_dS(Ns%s(tFormulaCellR�RSRR(RRR((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pytend_formula1scCs#|jj|j|j|j�dS(N(RjR+RR R(RRR((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pytend_cell6s(RhRiRRfRlRpRnR�R�t
start_formulaR�R�R�R�R�R�R�R�(((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRe�s 														R*cBseZdZRS(N(RhRiR
R(((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR*9s	R�cBsVeZded�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
RS(	s%scCs[t|ttttf�s!t�|tttfks<t�||_	||_
||_dS(N(R)RR�R�R�R(RRRR{R�RS(RR{R�RS((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRGs
!		cCs|jS(N(R{(RR((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRNscCs:y|j|j}Wnt|j�}nX||jfS(N(R�R{RKRS(RRR((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRDQs
cCs=t|dt|j�j�}dt|j|j|�fS(Nt_xml_s(<value align="%s" format="%s">%s</value>(RuttypeR{Rht	align2xmlRSR�(RRy((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRWXs

cCs8d|jkodknr*d|jS|j�SdS(Niis
<int>%s</int>I�i�I�(R{t	_xml_long(R((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt_xml_int_scCsd|jS(Ns<long>%s</long>(R{(R((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR�escCsdt|j�S(Ns<double>%s</double>(treprR{(R((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt
_xml_floathscCsdt|j�S(Ns<complex>%s</double>(R�R{(R((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt_xml_complexks(RhRiRRRRDRWR�R�R�R�(((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR�Es						R�cBs2eZded�Zd�Zd�Zd�ZRS(s%scCsUt|ttf�st�|tttfks6t�||_||_||_	dS(N(
R)RKtunicodeR(RRRRRR�RS(RRRR�RS((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRps
		cCs|jS(N(RR(RR((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRwscCs|j|jfS(N(RRRS(R((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRDzscCs-d}|t|j|jtj|j�fS(Ns9<value align="%s" format="%s"><string>%s</string></value>(R�RSR�RXRYRR(Rts((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRW}s

(RhRiRRRRDRW(((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR�ns		R�cBsDeZded�Zd�Zd�Zd�Zd�Zd�ZRS(s%scCsV|tttfkst�||_t|j�|_||_||_|j	�dS(N(
RRRR(tformulat	translatet
translatedR�RSRB(RR�R�RS((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR�s			cCs
d|_dS(N(R
R{(R((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRB�scCs�|jdkr�y4|jddt|j��|jd�|_Wq�tj�d}t|d�rw|j	|_q�t
|�|_q�Xn|jS(Ns from __future__ import division
s__value__ = eval(%s)t	__value__iRh(R{R
tr_execR�R�tr_evalR1texc_infoRRhRK(RRtexc((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR�s	cCs:y|j|j}Wnt|j�}nX||jfS(N(R�R{RKRS(RRR((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRD�s
cCsdt|j|j|jfS(Ns,<formula align="%s" format="%s">%s</formula>(R�RSR�R�(R((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRW�s
cCs�g}x�tjd|j�D]�}tjd|�}	|	dk	r�|	j�\}
}t|
�}t|�}
||ko�|knr�||
ko�|knr�t|||
|�}q�n|j	|�qWt
dj|�|j|j
�S(Ns(\w+)s^([A-Z]+)([1-9][0-9]*)$RE(tretsplitR�tmatchR
tgroupstcolname2numRtcellnameR"R�RZR�RS(RR#R$R%R&R6R7R[tpartRtsxtsyRR ((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR5�s8(	RhRiRRRBRRDRWR5(((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR��s				c	Cs�g}x�tjd|�D]�}tjd|�}|dkrM|j|�q|j�\}}}}t|�}|dkr�d||f}n"t|�}d||||f}|j|�qWdj|�S(s�Translate a formula containing fancy cell names to valid Python code.

    Examples:
        B4 -> cell(2, 4)
        B4:Z100 -> cells(2, 4, 26, 100)
    s(\w+(?::\w+)?)s2^([A-Z]+)([1-9][0-9]*)(?::([A-Z]+)([1-9][0-9]*))?$scell(%s, %s)scells(%s, %s, %s, %s)REN(R�R�R�R
R"R�R�RZ(	R�R[R�RR#R$R%R&R�((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR��scCs&|dkst�t|�t|�S(sETranslate a cell coordinate to a fancy cell name (e.g. (1, 1)->'A1').i(R(RIRK(RR ((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR��scCsk|j�}d}xR|D]J}d|ko6dknsAt�|dt|�td�d}qW|S(sCTranslate a column name to number (e.g. 'A'->1, 'Z'->26, 'AA'->27).itAtZii(tupperR(tord(R�Rtc((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR��s
"&cCs\|dkst�d}x=|rWt|dd�\}}t|td��|}qW|S(s6Translate a column number to name (e.g. 1->'A', etc.).iREiiR�(R(tdivmodtchrR�(RR�R((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRI�s	tSheetGUIcBs�eZdZdddd�Zd�Zd�Zd�Zd�Zd	�Zd
�Z	d�Z
d�Zd
�Zd�Z
d�ZeZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�ZRS(s7Beginnings of a GUI for a spreadsheet.

    TO DO:
    - clear multiple cells
    - Insert, clear, remove rows or columns
    - Show new contents while typing
    - Scroll bars
    - Grow grid when window is grown
    - Proper menus
    - Undo, redo
    - Cut, copy and paste
    - Formatting and alignment
    s
sheet1.xmli
icCs*||_t�|_tjj|�r:|jj|�n|jj�\}}t||�}t||�}t	j	�|_
|j
jd|j�t	j|j
dddd�|_
t	j|j
�|_t	j|j
ddd	|j�|_t	j|j
�|_|jjd
ddd
dd�|j
jd
d�|jjd
d�|jjd
ddd
dd�|jjd|j�|jjd|j�|jjd|j�|jjd|j�|jjd|j�|jjd|j�|j||�d|_d|_ |j!d
d
�|j"�dS(slConstructor.

        Load the sheet from the filename argument.
        Set up the Tk widget tree.
        sSpreadsheet: %sRRtA1tfontt	helveticaitboldtSavetcommandtsidetbottomtexpanditfilltbothR	R
Rs<Return>s<Shift-Return>s<Tab>s<Shift-Tab>s<Delete>s<Escape>N(R�iR�(#RaRRjtostpathtisfileRgRAR>tTktroottwm_titletLabeltbeacontEntrytentrytButtonRct
savebuttontFrametcellgridtpacktbindtreturn_eventtshift_return_eventt	tab_eventtshift_tab_eventtdelete_eventtescape_eventtmakegridR
t	currentxytcornerxyt
setcurrenttsync(RRatrowstcolumnsR?R@((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR�s<			cCsr|j|jkr>|jdk	r>|jj|j|j�n|jj|j�|j�|jjdd�dS(Nitendtbreak(	R�R�R
RjR0R-R�R�tdelete(Rtevent((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR�'s!
cCs#|j\}}|j||�dS(N(R�t
load_entry(RR�RR ((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR�0scCs�|jj||�}|dkr*d}n1t|t�rId|j}n|j�\}}|jjdd�|jj	d|�|jj
dd�dS(NREt=iR�(RjRR
R)R�R�RDR�R�tinserttselection_range(RRR RRRRS((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR�4s	c
Cs||_||_i|_tj|jdd�}|jdddddd�|jd|j�x�t	d	|d	�D]�}|jj
|d
d�tj|jdt|�dd�}|jd|dddd
�||j|df<||_d|_
|jd|j�|jd|j�|jd|j�|jd|j�qvWx�t	d	|d	�D]�}tj|jdt|�dd�}|jddd|dd
�||jd|f<d|_||_
|jd|j�|jd|j�|jd|j�|jd|j�q[Wx�t	d	|d	�D]�}x�t	d	|d	�D]�}tj|jdddddd�}|jd|d|dd�||j||f<||_||_
|jd|j�|jd|j�|jd|j�|jd|j�qDWq*WdS(s�Helper to create the grid of GUI cells.

        The edge (x==0 or y==0) is filled with labels; the rest is real cells.
        trelieftraisedtcolumniR}tstickytNSWEs<ButtonPress-1>itminsizei@RRtWEs<B1-Motion>s<ButtonRelease-1>s<Shift-Button-1>tsunkentbgtwhitetfgtblackN(R�R�t	gridcellsR�R�R�tgrid_configureR�t	selectallR!tgrid_columnconfigureRIt_SheetGUI__xt_SheetGUI__ytselectcolumntextendcolumnRKt	selectrowt	extendrowtpresstmotiontrelease(RR�R�RRR ((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR�@sN			$		$				cCs*|jdd�|jtjtj�dS(Ni(R�t	setcornerR1R2(RR�((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR�rscCs<|j|�\}}|j|d�|j|tj�dS(Ni(twhichxyR�RR1R2(RR�RR ((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR�vscCsR|j|�\}}|dkrN|j|jdd�|j|tj�ndS(Nii(RR�R�RR1R2(RR�RR ((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR�{scCs<|j|�\}}|jd|�|jtj|�dS(Ni(RR�RR1R2(RR�RR ((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR��scCsR|j|�\}}|dkrN|jd|jd�|jtj|�ndS(Nii(RR�R�RR1R2(RR�RR ((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR��scCsD|j|�\}}|dkr@|dkr@|j||�ndS(Ni(RR�(RR�RR ((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR��scCsD|j|�\}}|dkr@|dkr@|j||�ndS(Ni(RR(RR�RR ((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR��scCsh|jj|j|j�}|dk	rdt|tj�rdy|j|j	fSWqdt
k
r`qdXndS(Ni(ii(R�twinfo_containingtx_rootty_rootR
R)R�R�R�R�tAttributeError(RR�R((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR�s
cCs|jj|j�dS(N(RjRcRa(R((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRc�scCs�|jdk	r|j�n|j�t||�|jd<|j||�|jj�||f|_d|_	|j
j|j�}|dk	r�d|d<ndS(sMake (x, y) the current cell.RRtyellowR�N(R�R
tchange_cellt
clearfocusR�R�R�R�t	focus_setR�R�R'(RRR tgridcell((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR��s


	c	Csc|jdks$|j||fkr8|j||�dS|j�||f|_|j\}}|jpo|j\}}||kr�||}}n||kr�||}}nxh|jj�D]W\\}}}||ko�|knr�||ko|knr�d|d<q�q�W|jj|j�}|dk	rId|d<n|j||||�dS(Nt	lightBlueR�R(	R�R
R�RR�R�RLR't	setbeacon(	RRR R#R$R%R&RR
((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR�s$$
"8
cCs#||kodknrD||ko6tjknrDd}n�||fdtjfkr�||krxd|}qd||f}n�||fdtjfkr�||kr�dt|�}qdt|�t|�f}n.t|j�}t|j�}d||f}||jd<dS(Nit:s%ds%d:%ds%ss%s:%sRR(R1R2RIR�R�R�R�(RR#R$R%R&tnametname1tname2((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR�s;	
cCs�|jdk	r�|j\}}|jp-|j\}}||krR||}}n||krn||}}nxk|jj�D]W\\}}}||ko�|knr~||ko�|knr~d|d<q~q~WndS(NR�R�(R�R
R�R�RL(RR#R$R%R&RR R((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR�s"8cCs1|j�|j\}}|j||d�dS(sCallback for the Return key.iR�(RR�R�(RR�RR ((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR��s
cCs:|j�|j\}}|j|td|d��dS(s0Callback for the Return key with Shift modifier.iR�(RR�R�R>(RR�RR ((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR��s
cCs1|j�|j\}}|j|d|�dS(sCallback for the Tab key.iR�(RR�R�(RR�RR ((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR��s
cCs:|j�|j\}}|jtd|d�|�dS(s-Callback for the Tab key with Shift modifier.iR�(RR�R�R>(RR�RR ((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR��s
cCs�|j\}}|jj�}d}|jd�rFt|d�}nGxDtttt	fD]0}y||�}Wn
qYqYXt
|�}PqYW|dkr�|r�t|�}n|dkr�|jj
||�n|jj|||�|j�dS(s+Set the current cell from the entry widget.R�iN(R�R�R'R
t
startswithR�RR�R�R�R�R�RjR-R+R�(RRR RRRtclsR{((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRs$cCs�|jj�x�|jj�D]�\\}}}|dks|dkrMqn|jj||�}|dkr{d|d<qt|d�r�|j�\}}nt|�t	}}||d<t
||d<qWdS(s(Fill the GUI cells from the sheet cells.iRERRRDtanchorN(RjRR�RLRR
RRDRKRtalign2anchor(RRR R
RRRRS((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR�s
"

(RhRit__doc__RR�R�R�R�R�R�R�R�R�R�R�R�RRcR�RRRR�R�R�R�RR�(((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR��s4-					2																			cCs�ddl}t�}x�tdd�D]�}x�tdd�D]�}|dkr\t|�}nU|dkrwt|�}n:t|d�}td|�}d||f}t|�}|j|||�q;Wq%W|j�|jd�dS(sBasic non-gui self-test.i����Niis%s*%ss
sheet1.xml(	R�RR!R�R�R�R+RVRc(R�taRR Rtc1tc2R�((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt
test_basic,s	
cCs@tjdrtjd}nd}t|�}|jj�dS(s	GUI test.is
sheet1.xmlN(R1targvR�R�tmainloop(Ratg((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyttest_guiBs

R(#RR�R�R1RXRtxml.parsersRRRRRRRRMR�R�RRRReR*R�R�R�R�R�R�RItTkinterR�R�RRRh(((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt<module>s@				�Y)6						�C			PK�
Q\)�Yz�K�Kguido/sortvisu.pynuȯ��#! /usr/bin/python2.7

"""Sorting algorithms visualizer using Tkinter.

This module is comprised of three ``components'':

- an array visualizer with methods that implement basic sorting
operations (compare, swap) as well as methods for ``annotating'' the
sorting algorithm (e.g. to show the pivot element);

- a number of sorting algorithms (currently quicksort, insertion sort,
selection sort and bubble sort, as well as a randomization function),
all using the array visualizer for its basic operations and with calls
to its annotation methods;

- and a ``driver'' class which can be used as a Grail applet or as a
stand-alone application.

"""


from Tkinter import *
from Canvas import Line, Rectangle
import random


XGRID = 10
YGRID = 10
WIDTH = 6


class Array:

    def __init__(self, master, data=None):
        self.master = master
        self.frame = Frame(self.master)
        self.frame.pack(fill=X)
        self.label = Label(self.frame)
        self.label.pack()
        self.canvas = Canvas(self.frame)
        self.canvas.pack()
        self.report = Label(self.frame)
        self.report.pack()
        self.left = Line(self.canvas, 0, 0, 0, 0)
        self.right = Line(self.canvas, 0, 0, 0, 0)
        self.pivot = Line(self.canvas, 0, 0, 0, 0)
        self.items = []
        self.size = self.maxvalue = 0
        if data:
            self.setdata(data)

    def setdata(self, data):
        olditems = self.items
        self.items = []
        for item in olditems:
            item.delete()
        self.size = len(data)
        self.maxvalue = max(data)
        self.canvas.config(width=(self.size+1)*XGRID,
                           height=(self.maxvalue+1)*YGRID)
        for i in range(self.size):
            self.items.append(ArrayItem(self, i, data[i]))
        self.reset("Sort demo, size %d" % self.size)

    speed = "normal"

    def setspeed(self, speed):
        self.speed = speed

    def destroy(self):
        self.frame.destroy()

    in_mainloop = 0
    stop_mainloop = 0

    def cancel(self):
        self.stop_mainloop = 1
        if self.in_mainloop:
            self.master.quit()

    def step(self):
        if self.in_mainloop:
            self.master.quit()

    Cancelled = "Array.Cancelled"       # Exception

    def wait(self, msecs):
        if self.speed == "fastest":
            msecs = 0
        elif self.speed == "fast":
            msecs = msecs//10
        elif self.speed == "single-step":
            msecs = 1000000000
        if not self.stop_mainloop:
            self.master.update()
            id = self.master.after(msecs, self.master.quit)
            self.in_mainloop = 1
            self.master.mainloop()
            self.master.after_cancel(id)
            self.in_mainloop = 0
        if self.stop_mainloop:
            self.stop_mainloop = 0
            self.message("Cancelled")
            raise Array.Cancelled

    def getsize(self):
        return self.size

    def show_partition(self, first, last):
        for i in range(self.size):
            item = self.items[i]
            if first <= i < last:
                item.item.config(fill='red')
            else:
                item.item.config(fill='orange')
        self.hide_left_right_pivot()

    def hide_partition(self):
        for i in range(self.size):
            item = self.items[i]
            item.item.config(fill='red')
        self.hide_left_right_pivot()

    def show_left(self, left):
        if not 0 <= left < self.size:
            self.hide_left()
            return
        x1, y1, x2, y2 = self.items[left].position()
##      top, bot = HIRO
        self.left.coords([(x1-2, 0), (x1-2, 9999)])
        self.master.update()

    def show_right(self, right):
        if not 0 <= right < self.size:
            self.hide_right()
            return
        x1, y1, x2, y2 = self.items[right].position()
        self.right.coords(((x2+2, 0), (x2+2, 9999)))
        self.master.update()

    def hide_left_right_pivot(self):
        self.hide_left()
        self.hide_right()
        self.hide_pivot()

    def hide_left(self):
        self.left.coords(((0, 0), (0, 0)))

    def hide_right(self):
        self.right.coords(((0, 0), (0, 0)))

    def show_pivot(self, pivot):
        x1, y1, x2, y2 = self.items[pivot].position()
        self.pivot.coords(((0, y1-2), (9999, y1-2)))

    def hide_pivot(self):
        self.pivot.coords(((0, 0), (0, 0)))

    def swap(self, i, j):
        if i == j: return
        self.countswap()
        item = self.items[i]
        other = self.items[j]
        self.items[i], self.items[j] = other, item
        item.swapwith(other)

    def compare(self, i, j):
        self.countcompare()
        item = self.items[i]
        other = self.items[j]
        return item.compareto(other)

    def reset(self, msg):
        self.ncompares = 0
        self.nswaps = 0
        self.message(msg)
        self.updatereport()
        self.hide_partition()

    def message(self, msg):
        self.label.config(text=msg)

    def countswap(self):
        self.nswaps = self.nswaps + 1
        self.updatereport()

    def countcompare(self):
        self.ncompares = self.ncompares + 1
        self.updatereport()

    def updatereport(self):
        text = "%d cmps, %d swaps" % (self.ncompares, self.nswaps)
        self.report.config(text=text)


class ArrayItem:

    def __init__(self, array, index, value):
        self.array = array
        self.index = index
        self.value = value
        x1, y1, x2, y2 = self.position()
        self.item = Rectangle(array.canvas, x1, y1, x2, y2,
                              fill='red', outline='black', width=1)
        self.item.bind('<Button-1>', self.mouse_down)
        self.item.bind('<Button1-Motion>', self.mouse_move)
        self.item.bind('<ButtonRelease-1>', self.mouse_up)

    def delete(self):
        item = self.item
        self.array = None
        self.item = None
        item.delete()

    def mouse_down(self, event):
        self.lastx = event.x
        self.lasty = event.y
        self.origx = event.x
        self.origy = event.y
        self.item.tkraise()

    def mouse_move(self, event):
        self.item.move(event.x - self.lastx, event.y - self.lasty)
        self.lastx = event.x
        self.lasty = event.y

    def mouse_up(self, event):
        i = self.nearestindex(event.x)
        if i >= self.array.getsize():
            i = self.array.getsize() - 1
        if i < 0:
            i = 0
        other = self.array.items[i]
        here = self.index
        self.array.items[here], self.array.items[i] = other, self
        self.index = i
        x1, y1, x2, y2 = self.position()
        self.item.coords(((x1, y1), (x2, y2)))
        other.setindex(here)

    def setindex(self, index):
        nsteps = steps(self.index, index)
        if not nsteps: return
        if self.array.speed == "fastest":
            nsteps = 0
        oldpts = self.position()
        self.index = index
        newpts = self.position()
        trajectory = interpolate(oldpts, newpts, nsteps)
        self.item.tkraise()
        for pts in trajectory:
            self.item.coords((pts[:2], pts[2:]))
            self.array.wait(50)

    def swapwith(self, other):
        nsteps = steps(self.index, other.index)
        if not nsteps: return
        if self.array.speed == "fastest":
            nsteps = 0
        myoldpts = self.position()
        otheroldpts = other.position()
        self.index, other.index = other.index, self.index
        mynewpts = self.position()
        othernewpts = other.position()
        myfill = self.item['fill']
        otherfill = other.item['fill']
        self.item.config(fill='green')
        other.item.config(fill='yellow')
        self.array.master.update()
        if self.array.speed == "single-step":
            self.item.coords((mynewpts[:2], mynewpts[2:]))
            other.item.coords((othernewpts[:2], othernewpts[2:]))
            self.array.master.update()
            self.item.config(fill=myfill)
            other.item.config(fill=otherfill)
            self.array.wait(0)
            return
        mytrajectory = interpolate(myoldpts, mynewpts, nsteps)
        othertrajectory = interpolate(otheroldpts, othernewpts, nsteps)
        if self.value > other.value:
            self.item.tkraise()
            other.item.tkraise()
        else:
            other.item.tkraise()
            self.item.tkraise()
        try:
            for i in range(len(mytrajectory)):
                mypts = mytrajectory[i]
                otherpts = othertrajectory[i]
                self.item.coords((mypts[:2], mypts[2:]))
                other.item.coords((otherpts[:2], otherpts[2:]))
                self.array.wait(50)
        finally:
            mypts = mytrajectory[-1]
            otherpts = othertrajectory[-1]
            self.item.coords((mypts[:2], mypts[2:]))
            other.item.coords((otherpts[:2], otherpts[2:]))
            self.item.config(fill=myfill)
            other.item.config(fill=otherfill)

    def compareto(self, other):
        myfill = self.item['fill']
        otherfill = other.item['fill']
        outcome = cmp(self.value, other.value)
        if outcome < 0:
            myflash = 'white'
            otherflash = 'black'
        elif outcome > 0:
            myflash = 'black'
            otherflash = 'white'
        else:
            myflash = otherflash = 'grey'
        try:
            self.item.config(fill=myflash)
            other.item.config(fill=otherflash)
            self.array.wait(500)
        finally:
            self.item.config(fill=myfill)
            other.item.config(fill=otherfill)
        return outcome

    def position(self):
        x1 = (self.index+1)*XGRID - WIDTH//2
        x2 = x1+WIDTH
        y2 = (self.array.maxvalue+1)*YGRID
        y1 = y2 - (self.value)*YGRID
        return x1, y1, x2, y2

    def nearestindex(self, x):
        return int(round(float(x)/XGRID)) - 1


# Subroutines that don't need an object

def steps(here, there):
    nsteps = abs(here - there)
    if nsteps <= 3:
        nsteps = nsteps * 3
    elif nsteps <= 5:
        nsteps = nsteps * 2
    elif nsteps > 10:
        nsteps = 10
    return nsteps

def interpolate(oldpts, newpts, n):
    if len(oldpts) != len(newpts):
        raise ValueError, "can't interpolate arrays of different length"
    pts = [0]*len(oldpts)
    res = [tuple(oldpts)]
    for i in range(1, n):
        for k in range(len(pts)):
            pts[k] = oldpts[k] + (newpts[k] - oldpts[k])*i//n
        res.append(tuple(pts))
    res.append(tuple(newpts))
    return res


# Various (un)sorting algorithms

def uniform(array):
    size = array.getsize()
    array.setdata([(size+1)//2] * size)
    array.reset("Uniform data, size %d" % size)

def distinct(array):
    size = array.getsize()
    array.setdata(range(1, size+1))
    array.reset("Distinct data, size %d" % size)

def randomize(array):
    array.reset("Randomizing")
    n = array.getsize()
    for i in range(n):
        j = random.randint(0, n-1)
        array.swap(i, j)
    array.message("Randomized")

def insertionsort(array):
    size = array.getsize()
    array.reset("Insertion sort")
    for i in range(1, size):
        j = i-1
        while j >= 0:
            if array.compare(j, j+1) <= 0:
                break
            array.swap(j, j+1)
            j = j-1
    array.message("Sorted")

def selectionsort(array):
    size = array.getsize()
    array.reset("Selection sort")
    try:
        for i in range(size):
            array.show_partition(i, size)
            for j in range(i+1, size):
                if array.compare(i, j) > 0:
                    array.swap(i, j)
        array.message("Sorted")
    finally:
        array.hide_partition()

def bubblesort(array):
    size = array.getsize()
    array.reset("Bubble sort")
    for i in range(size):
        for j in range(1, size):
            if array.compare(j-1, j) > 0:
                array.swap(j-1, j)
    array.message("Sorted")

def quicksort(array):
    size = array.getsize()
    array.reset("Quicksort")
    try:
        stack = [(0, size)]
        while stack:
            first, last = stack[-1]
            del stack[-1]
            array.show_partition(first, last)
            if last-first < 5:
                array.message("Insertion sort")
                for i in range(first+1, last):
                    j = i-1
                    while j >= first:
                        if array.compare(j, j+1) <= 0:
                            break
                        array.swap(j, j+1)
                        j = j-1
                continue
            array.message("Choosing pivot")
            j, i, k = first, (first+last)//2, last-1
            if array.compare(k, i) < 0:
                array.swap(k, i)
            if array.compare(k, j) < 0:
                array.swap(k, j)
            if array.compare(j, i) < 0:
                array.swap(j, i)
            pivot = j
            array.show_pivot(pivot)
            array.message("Pivot at left of partition")
            array.wait(1000)
            left = first
            right = last
            while 1:
                array.message("Sweep right pointer")
                right = right-1
                array.show_right(right)
                while right > first and array.compare(right, pivot) >= 0:
                    right = right-1
                    array.show_right(right)
                array.message("Sweep left pointer")
                left = left+1
                array.show_left(left)
                while left < last and array.compare(left, pivot) <= 0:
                    left = left+1
                    array.show_left(left)
                if left > right:
                    array.message("End of partition")
                    break
                array.message("Swap items")
                array.swap(left, right)
            array.message("Swap pivot back")
            array.swap(pivot, right)
            n1 = right-first
            n2 = last-left
            if n1 > 1: stack.append((first, right))
            if n2 > 1: stack.append((left, last))
        array.message("Sorted")
    finally:
        array.hide_partition()

def demosort(array):
    while 1:
        for alg in [quicksort, insertionsort, selectionsort, bubblesort]:
            randomize(array)
            alg(array)


# Sort demo class -- usable as a Grail applet

class SortDemo:

    def __init__(self, master, size=15):
        self.master = master
        self.size = size
        self.busy = 0
        self.array = Array(self.master)

        self.botframe = Frame(master)
        self.botframe.pack(side=BOTTOM)
        self.botleftframe = Frame(self.botframe)
        self.botleftframe.pack(side=LEFT, fill=Y)
        self.botrightframe = Frame(self.botframe)
        self.botrightframe.pack(side=RIGHT, fill=Y)

        self.b_qsort = Button(self.botleftframe,
                              text="Quicksort", command=self.c_qsort)
        self.b_qsort.pack(fill=X)
        self.b_isort = Button(self.botleftframe,
                              text="Insertion sort", command=self.c_isort)
        self.b_isort.pack(fill=X)
        self.b_ssort = Button(self.botleftframe,
                              text="Selection sort", command=self.c_ssort)
        self.b_ssort.pack(fill=X)
        self.b_bsort = Button(self.botleftframe,
                              text="Bubble sort", command=self.c_bsort)
        self.b_bsort.pack(fill=X)

        # Terrible hack to overcome limitation of OptionMenu...
        class MyIntVar(IntVar):
            def __init__(self, master, demo):
                self.demo = demo
                IntVar.__init__(self, master)
            def set(self, value):
                IntVar.set(self, value)
                if str(value) != '0':
                    self.demo.resize(value)

        self.v_size = MyIntVar(self.master, self)
        self.v_size.set(size)
        sizes = [1, 2, 3, 4] + range(5, 55, 5)
        if self.size not in sizes:
            sizes.append(self.size)
            sizes.sort()
        self.m_size = apply(OptionMenu,
                            (self.botleftframe, self.v_size) + tuple(sizes))
        self.m_size.pack(fill=X)

        self.v_speed = StringVar(self.master)
        self.v_speed.set("normal")
        self.m_speed = OptionMenu(self.botleftframe, self.v_speed,
                                  "single-step", "normal", "fast", "fastest")
        self.m_speed.pack(fill=X)

        self.b_step = Button(self.botleftframe,
                             text="Step", command=self.c_step)
        self.b_step.pack(fill=X)

        self.b_randomize = Button(self.botrightframe,
                                  text="Randomize", command=self.c_randomize)
        self.b_randomize.pack(fill=X)
        self.b_uniform = Button(self.botrightframe,
                                  text="Uniform", command=self.c_uniform)
        self.b_uniform.pack(fill=X)
        self.b_distinct = Button(self.botrightframe,
                                  text="Distinct", command=self.c_distinct)
        self.b_distinct.pack(fill=X)
        self.b_demo = Button(self.botrightframe,
                             text="Demo", command=self.c_demo)
        self.b_demo.pack(fill=X)
        self.b_cancel = Button(self.botrightframe,
                               text="Cancel", command=self.c_cancel)
        self.b_cancel.pack(fill=X)
        self.b_cancel.config(state=DISABLED)
        self.b_quit = Button(self.botrightframe,
                             text="Quit", command=self.c_quit)
        self.b_quit.pack(fill=X)

    def resize(self, newsize):
        if self.busy:
            self.master.bell()
            return
        self.size = newsize
        self.array.setdata(range(1, self.size+1))

    def c_qsort(self):
        self.run(quicksort)

    def c_isort(self):
        self.run(insertionsort)

    def c_ssort(self):
        self.run(selectionsort)

    def c_bsort(self):
        self.run(bubblesort)

    def c_demo(self):
        self.run(demosort)

    def c_randomize(self):
        self.run(randomize)

    def c_uniform(self):
        self.run(uniform)

    def c_distinct(self):
        self.run(distinct)

    def run(self, func):
        if self.busy:
            self.master.bell()
            return
        self.busy = 1
        self.array.setspeed(self.v_speed.get())
        self.b_cancel.config(state=NORMAL)
        try:
            func(self.array)
        except Array.Cancelled:
            pass
        self.b_cancel.config(state=DISABLED)
        self.busy = 0

    def c_cancel(self):
        if not self.busy:
            self.master.bell()
            return
        self.array.cancel()

    def c_step(self):
        if not self.busy:
            self.master.bell()
            return
        self.v_speed.set("single-step")
        self.array.setspeed("single-step")
        self.array.step()

    def c_quit(self):
        if self.busy:
            self.array.cancel()
        self.master.after_idle(self.master.quit)


# Main program -- for stand-alone operation outside Grail

def main():
    root = Tk()
    demo = SortDemo(root)
    root.protocol('WM_DELETE_WINDOW', demo.c_quit)
    root.mainloop()

if __name__ == '__main__':
    main()
PK�
Q\~H�+��guido/ShellWindow.pyonu�[����
��^c@s�ddlZddlZddlZddlTddlmZddlmZddlZdZdefd��YZdZ	d	�Z
d
�Zedkr�e�ndS(i����N(t*(tScrolledText(tDialogitShellWindowcBsheZd
d
d�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd	�ZRS(cKs|s>ytjd}Wntk
r0d}nX|d}ntj|�}|d}ttj||f|�d|_|j	d|j
�|j	d|j�|j	d|j�|j	d	|j
�|j	d
|j�t||�\|_|_|_|jj|jt|j�dS(NtSHELLs/bin/shs -iis1.0s<Return>s<Control-c>s<Control-t>s<Control-k>s<Control-d>(tostenvirontKeyErrortstringtsplittapplyRt__init__tpostbindtinputhandlertsiginttsigtermtsigkilltsendeoftspawntpidt	fromchildttochildttktcreatefilehandlertREADABLEt
outputhandler(tselftmastertshelltcnftargs((s6/usr/lib64/python2.7/Demo/tkinter/guido/ShellWindow.pyR
s$



	!c	Cstj|t�}|s�|jj|�tj|jd�\}}dG|GdG|GHd|_|d?}|d@}|dkr�d|}n%d|d@}|d	@r�|d
}nt|j	d|dd
dddddd�dS|j
t|�|jd�|_
|jt�dS(NiRtstatusii�sexit status %dskilled by signal %dii�s -- core dumpedttextttitlesExit statustbitmaptwarningtdefaulttstringstOKsend - 1 char(R'(RtreadtBUFSIZERtdeletefilehandlertwaitpidRtNoneRRtinserttENDtindexRtyview_pickplace(	RtfiletmasktdataRtststdetailtcausetmsg((s6/usr/lib64/python2.7/Demo/tkinter/guido/ShellWindow.pyR#s.	




cGse|js|j�dS|jtd�|j|jd�}|jt�|_tj|j	|�dS(Ntbreaks
send - 1 char(
Rt
no_processR-R.tgetRR/RtwriteR(RRtline((s6/usr/lib64/python2.7/Demo/tkinter/guido/ShellWindow.pyR=s	
cGs+|js|j�dStj|j�dS(NR8(RR9RtcloseR(RR((s6/usr/lib64/python2.7/Demo/tkinter/guido/ShellWindow.pyRGs
	
cCs.|js|j�dStj|j|�dS(NR8(RR9Rtkill(Rtsig((s6/usr/lib64/python2.7/Demo/tkinter/guido/ShellWindow.pytsendsigNs
	
cGs|jtj�S(N(R@tsignaltSIGINT(RR((s6/usr/lib64/python2.7/Demo/tkinter/guido/ShellWindow.pyRUscGs|jtj�S(N(R@RAtSIGQUIT(RR((s6/usr/lib64/python2.7/Demo/tkinter/guido/ShellWindow.pytsigquitXscGs|jtj�S(N(R@RAtSIGTERM(RR((s6/usr/lib64/python2.7/Demo/tkinter/guido/ShellWindow.pyR[scGs|jtj�S(N(R@RAtSIGKILL(RR((s6/usr/lib64/python2.7/Demo/tkinter/guido/ShellWindow.pyR^scCs/t|jddddddddd	d�dS(NR!sNo active processR"s
No processR#terrorR%iR&R'(R'(RR(R((s6/usr/lib64/python2.7/Demo/tkinter/guido/ShellWindow.pyR9asN(
t__name__t
__module__R,RRRRR@RRDRRR9(((s6/usr/lib64/python2.7/Demo/tkinter/guido/ShellWindow.pyRs		
						idcCs\tj�\}}tj�\}}tj�}|dkr5x6dD].}ytj|�WqCtjk
rpqCXqCWtj|�dkr�tjjd�ntj|�dkr�tjjd�ntj|�dkr�tjjd�ntj	dt
�ztj||�Wdtjjd�tjd�Xntj|�tj|�|||fS(	Niiispopen2: bad read dup
spopen2: bad write dup
isexecvp failed
(iii(
RtpipetforkR=RGtduptsyststderrR;t
closerangetMAXFDtexecvpt_exit(tprogRtp2creadtp2cwritetc2preadtc2pwriteRti((s6/usr/lib64/python2.7/Demo/tkinter/guido/ShellWindow.pyRks.


cCs�tjtjd�}t�}|jdd�|rJt|d|�}nt|�}|jdddt�|j	�|j
j�dS(NiRtexpandtfill(RtjoinRMtargvtTktminsizeRtpacktBOTHt	focus_setRtmainloop(Rtroottw((s6/usr/lib64/python2.7/Demo/tkinter/guido/ShellWindow.pyttest�s	
t__main__(
RRMRtTkinterRRRAR)RRPRReRH(((s6/usr/lib64/python2.7/Demo/tkinter/guido/ShellWindow.pyt<module>s
^		PK�
Q\���X�#�#guido/tkman.pycnu�[����
Afc@s�ddlZddlZddlZddlZddlTddlmZddgZddgZdZx/eD]'Z	ej
je	�roe	Zd	ZqoqoWdZ
x/eD]'Z	ej
je	�r�e	Zd	Z
q�q�Wes�e
r\ejjd
�esdejdZejjde�ne
sLd
ejdZejjde�nejd	�n[[
d�Zddd��YZd�Ze�dS(i����N(t*(tManPages/depot/sundry/man/manns/usr/local/man/manns/depot/sundry/man/man3s/usr/local/man/man3iis
sgFailed to find mann directory.
Please add the correct entry to the MANNDIRLIST
at the top of %s script.s%s

sgFailed to find man3 directory.
Please add the correct entry to the MAN3DIRLIST
at the top of %s script.cCsktj|�}g}xE|D]=}|dd!dkr|ddkr|j|d �qqW|j�|S(Ni����i����t.tln123456789(tostlistdirtappendtsort(tmandirtfilestnamestfile((s0/usr/lib64/python2.7/Demo/tkinter/guido/tkman.pytlistmanpages0s
#
tSelectionBoxcBs�eZdd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
d�Zd�Zd
�ZRS(cCs�g|_t|dd�|_|jjdddt�|jj|_t|jdd�|_|jjdddt�t|jdd�|_|jjd	tdddt�t|jdd
�|_	|j	jd	t
dddt�t|�|_t
|j	dddd
dtdd�|_|jjd	t�t|jdd�|_|jjdddtd|jd|j�|jjdddtd|jd|j�|j|jd<t|j	dddtdddddd�|_|jjdddt�t|jddddd|j�|_|jjd	t�t|jdd dtdddd�|_|jjdddt�t|jdd!�|_ |j jdddt!�t|j dd"dd#d|j"�|_#|j#jd	t�t$�|_%t&|j dd$dd%d|j%dt'�|_(|j(jd	t�t|jdd&dtdddd�|_)|j)jdddt�t*|jdd'dd(�|_+|j+jd	t,�t-|jdddtddd)t!dd*d+d,�|_.|j.jdddt�|jj/d-|j�|j)j/d-|j"�|jj/d.|j0�|jj/d/|j1�|j)j/d/|j2�|j.j/d/|j3�|jj4�|jj5t�|j�dS(0Ntnametframetexpanditfilltsubframeitleftsubframetsidet
rightsubframetchapterttextt	DirectorytrelieftborderwidthitchaptermenutlabelsC functionstvaluetvariabletcommandsTcl/Tk functionstmenutlistboxtwidthitheightitl1sDisplay manual page named:tentrytl2frametl2sSearch regexp:t	casesensesCase sensitivetsearchttitles(none)twrapiHtselectbackgroundtpinks<Return>s
<Double-1>s<Tab>(6tchoicestFrameRtpacktBOTHtmasterRRtLEFTRtRIGHTt	StringVart
chaptervart
MenubuttontRAISEDRtTOPtMenuRtadd_radiobuttontMAN3DIRt
newchaptertMANNDIRtListboxtSUNKENR!tButtontentry_cbR$tEntryR%tXR&tNONEt	search_cbR't
BooleanVartcasevartCheckbuttontFLATR(R)tLabelR*tBOTTOMRRtbindt
listbox_cbt	entry_tabt
search_tabttext_tabt	focus_settset(tselfR2((s0/usr/lib64/python2.7/Demo/tkinter/guido/tkman.pyt__init__;s�		
	
	
cCs/|jj�}g|_|jt|��dS(N(R6tgetR.taddlistR(RTR((s0/usr/lib64/python2.7/Demo/tkinter/guido/tkman.pyR=�s	cCs=||jkr/|jj|�|jj�n|j�dS(N(R.RRtupdate(RTtchoice((s0/usr/lib64/python2.7/Demo/tkinter/guido/tkman.pyt	addchoice�scCs1||jt|j�)|jj�|j�dS(N(R.tlenRRX(RTtlist((s0/usr/lib64/python2.7/Demo/tkinter/guido/tkman.pyRW�s
cGs|j�dS(N(RX(RTte((s0/usr/lib64/python2.7/Demo/tkinter/guido/tkman.pyRB�scCsQ|jj�}|rMt|�dkrM|jj|d�}|j|�ndS(Nii(R!tcurselectionR[RVt	show_page(RTR]t	selectionR((s0/usr/lib64/python2.7/Demo/tkinter/guido/tkman.pyRN�scGs|j|jj��dS(N(t
search_stringR)RV(RTR]((s0/usr/lib64/python2.7/Demo/tkinter/guido/tkman.pyRF�scCs|jj�dS(N(R)RR(RTR]((s0/usr/lib64/python2.7/Demo/tkinter/guido/tkman.pyRO�scCs|jj�dS(N(R%RR(RTR]((s0/usr/lib64/python2.7/Demo/tkinter/guido/tkman.pyRP�scCs|jj�dS(N(R%RR(RTR]((s0/usr/lib64/python2.7/Demo/tkinter/guido/tkman.pyRQ�scCs�|jj�}t|t|�d�|j�}|sF|jj�n|jjdt	��d}x9|D]1}||kr�d}n|jj
t	�|�qiW|r�|S|jj�}|dkr�|jjd�SdS(NcSs|| |kS(N((Rtkeytn((s0/usr/lib64/python2.7/Demo/tkinter/guido/tkman.pyt<lambda>�tii(R%RVtfilterR[R.RtbellR!tdeletetAtEndtinserttsize(RTRbtokt
exactmatchtitemRc((s0/usr/lib64/python2.7/Demo/tkinter/guido/tkman.pyt
updatelist�s 
	cCsF|j�}|rB|j|�|jjdt��|j�ndS(Ni(RoR_R%RhRi(RTR((s0/usr/lib64/python2.7/Demo/tkinter/guido/tkman.pyRX�s

cCs]d|jj�|f}tjd|d�}|jj�||jd<|jj|�dS(Ns%s/%s.?snroff -man %s | ul -itrR(R6RVRtpopenRtkillR*t	parsefile(RTRRtfp((s0/usr/lib64/python2.7/Demo/tkinter/guido/tkman.pyR_�s


cCs`|s|jj�dGHdS|jj�s7tj}nd}y.|r[tj||�}ntj|�}Wn-tjk
r�}|jj�dG|GHdSX|j	j
t��}tj
|tj|d� �}|j	j
t��}tj
|tj|d� �}|}	d}
x4|d}||krM|	dkr8Pn|	}d}d}	n|j	jd|d|�}|j|�}|dkrd}
tdt|jd���}
y |j	jdt�t��Wntk
r�nX|j	jdd	||fd	|||
f�|j	jt�d	||f�|j	jt��PqqW|
s\|jj�ndS(
NsEmpty search stringsRegex error:Riis%d.0 linestarts%d.0 lineendtsels%d.%d(RRgRHRVtret
IGNORECASEtNonetcompileterrorRtindextAtInserttstringtatoitfindRiR)tmaxR[tgroupt
tag_removet
AtSelFirstt	AtSelLasttTclErrorttag_addtmark_settyview_pickplace(RTR)tmaptprogtmsgtheretlinenotendt	endlinenot
wraplinenotfoundtlinetiRc((s0/usr/lib64/python2.7/Demo/tkinter/guido/tkman.pyRa�sd

	
	


N(t__name__t
__module__RxRUR=RZRWRBRNRFRORPRQRoRXR_Ra(((s0/usr/lib64/python2.7/Demo/tkinter/guido/tkman.pyR
9sM												cCsWt�}t|�}tjdr9|jtjd�n|jdd�|j�dS(Ni(tTkR
tsystargvR_tminsizetmainloop(troottsb((s0/usr/lib64/python2.7/Demo/tkinter/guido/tkman.pytmains	
((R�RR}RvtTkinterRtMANNDIRLISTtMAN3DIRLISTtfoundmanndirtdirtpathtexistsR>tfoundman3dirR<tstderrtwriteR�R�texitRR
R�(((s0/usr/lib64/python2.7/Demo/tkinter/guido/tkman.pyt<module>sD




		�	PK�
Q\�h��guido/imagedraw.pycnu�[����
��^c@s9dZddlTddlZd�Zd�Ze�dS(sDraw on top of an imagei����(t*NcCs�tjd}t�}td|�}|j�|j�}}t|d|d|�}|jdddtd|�|j	�|j
dt�|j�dS(	Nitfiletwidththeightitanchortimages
<Button-1>(
tsystargvtTkt
PhotoImageRRtCanvastcreate_imagetNWtpacktbindtblobtmainloop(tfilenametroottimgtwthtcanv((s4/usr/lib64/python2.7/Demo/tkinter/guido/imagedraw.pytmains
	
c	CsX|j|j}}|j}d}|j||||||||dddd�dS(Nitfilltredtoutlinet(txtytwidgettcreate_oval(teventRRRtr((s4/usr/lib64/python2.7/Demo/tkinter/guido/imagedraw.pyRs	(t__doc__tTkinterRRR(((s4/usr/lib64/python2.7/Demo/tkinter/guido/imagedraw.pyt<module>s

		PK�
Q\��I��guido/rmt.pynuȯ��#! /usr/bin/python2.7

# A Python program implementing rmt, an application for remotely
# controlling other Tk applications.
# Cf. Ousterhout, Tcl and the Tk Toolkit, Figs. 27.5-8, pp. 273-276.

# Note that because of forward references in the original, we
# sometimes delay bindings until after the corresponding procedure is
# defined.  We also introduce names for some unnamed code blocks in
# the original because of restrictions on lambda forms in Python.

# XXX This should be written in a more Python-like style!!!

from Tkinter import *
import sys

# 1. Create basic application structure: menu bar on top of
# text widget, scrollbar on right.

root = Tk()
tk = root.tk
mBar = Frame(root, relief=RAISED, borderwidth=2)
mBar.pack(fill=X)

f = Frame(root)
f.pack(expand=1, fill=BOTH)
s = Scrollbar(f, relief=FLAT)
s.pack(side=RIGHT, fill=Y)
t = Text(f, relief=RAISED, borderwidth=2, yscrollcommand=s.set, setgrid=1)
t.pack(side=LEFT, fill=BOTH, expand=1)
t.tag_config('bold', font='-Adobe-Courier-Bold-R-Normal-*-120-*')
s['command'] = t.yview

root.title('Tk Remote Controller')
root.iconname('Tk Remote')

# 2. Create menu button and menus.

file = Menubutton(mBar, text='File', underline=0)
file.pack(side=LEFT)
file_m = Menu(file)
file['menu'] = file_m
file_m_apps = Menu(file_m, tearoff=0)
file_m.add_cascade(label='Select Application', underline=0,
                   menu=file_m_apps)
file_m.add_command(label='Quit', underline=0, command=sys.exit)

# 3. Create bindings for text widget to allow commands to be
# entered and information to be selected.  New characters
# can only be added at the end of the text (can't ever move
# insertion point).

def single1(e):
    x = e.x
    y = e.y
    t.setvar('tk_priv(selectMode)', 'char')
    t.mark_set('anchor', At(x, y))
    # Should focus W
t.bind('<1>', single1)

def double1(e):
    x = e.x
    y = e.y
    t.setvar('tk_priv(selectMode)', 'word')
    t.tk_textSelectTo(At(x, y))
t.bind('<Double-1>', double1)

def triple1(e):
    x = e.x
    y = e.y
    t.setvar('tk_priv(selectMode)', 'line')
    t.tk_textSelectTo(At(x, y))
t.bind('<Triple-1>', triple1)

def returnkey(e):
    t.insert(AtInsert(), '\n')
    invoke()
t.bind('<Return>', returnkey)

def controlv(e):
    t.insert(AtInsert(), t.selection_get())
    t.yview_pickplace(AtInsert())
    if t.index(AtInsert())[-2:] == '.0':
        invoke()
t.bind('<Control-v>', controlv)

# 4. Procedure to backspace over one character, as long as
# the character isn't part of the prompt.

def backspace(e):
    if t.index('promptEnd') != t.index('insert - 1 char'):
        t.delete('insert - 1 char', AtInsert())
        t.yview_pickplace(AtInsert())
t.bind('<BackSpace>', backspace)
t.bind('<Control-h>', backspace)
t.bind('<Delete>', backspace)


# 5. Procedure that's invoked when return is typed:  if
# there's not yet a complete command (e.g. braces are open)
# then do nothing.  Otherwise, execute command (locally or
# remotely), output the result or error message, and issue
# a new prompt.

def invoke():
    cmd = t.get('promptEnd + 1 char', AtInsert())
    if t.getboolean(tk.call('info', 'complete', cmd)): # XXX
        if app == root.winfo_name():
            msg = tk.call('eval', cmd) # XXX
        else:
            msg = t.send(app, cmd)
        if msg:
            t.insert(AtInsert(), msg + '\n')
        prompt()
    t.yview_pickplace(AtInsert())

def prompt():
    t.insert(AtInsert(), app + ': ')
    t.mark_set('promptEnd', 'insert - 1 char')
    t.tag_add('bold', 'insert linestart', 'promptEnd')

# 6. Procedure to select a new application.  Also changes
# the prompt on the current command line to reflect the new
# name.

def newApp(appName):
    global app
    app = appName
    t.delete('promptEnd linestart', 'promptEnd')
    t.insert('promptEnd', appName + ':')
    t.tag_add('bold', 'promptEnd linestart', 'promptEnd')

def fillAppsMenu():
    file_m_apps.add('command')
    file_m_apps.delete(0, 'last')
    names = root.winfo_interps()
    names = list(names)
    names.sort()
    for name in names:
        try:
            root.send(name, 'winfo name .')
        except TclError:
            # Inoperative window -- ignore it
            pass
        else:
            file_m_apps.add_command(
                label=name,
                command=lambda name=name: newApp(name))

file_m_apps['postcommand'] = fillAppsMenu
mBar.tk_menuBar(file)

# 7. Miscellaneous initialization.

app = root.winfo_name()
prompt()
t.focus()

root.mainloop()
PK�
Q\&Y���guido/listtree.pyonu�[����
��^c@sWddlZddlZddlTd�Zd�Zd�ZedkrSe�ndS(i����N(t*cCs?t|dd�}|jdddt�t||dd�|S(Ntnametlisttexpanditfillt.i(tListboxtpacktBOTHt	listnodes(tmastertappR((s3/usr/lib64/python2.7/Demo/tkinter/guido/listtree.pytlisttreescCs�|j|dd|�}|jtd||f�|jj|j|dd|��}x%|D]}t||||d�q]WdS(Ntwinfotclasss%s (%s)tchildreni(tsendtinserttENDttkt	splitlistR	(RRtwidgettleveltklassRtc((s3/usr/lib64/python2.7/Demo/tkinter/guido/listtree.pyR	s	
cCs�tjds-tjjd�tjd�ntjd}t�}|jdd�t|dd�}|jdddt	�t
||�}|j�dS(NisUsage: listtree appname
iRtfRR(tsystargvtstderrtwritetexittTktminsizetFrameRRRtmainloop(RRRR((s3/usr/lib64/python2.7/Demo/tkinter/guido/listtree.pytmains

	t__main__(RtstringtTkinterRR	R#t__name__(((s3/usr/lib64/python2.7/Demo/tkinter/guido/listtree.pyt<module>s
		
	PK�
Q\�^u�iiguido/switch.pycnu�[����
��^c@sfddlTddd��YZddd��YZdd
d��YZd�Zed	krbe�nd
S(i����(t*tAppcBs)eZddd�Zd�Zd�ZRS(cCs�|dkr3|dkr$t�}q3t|�}n||_t|�|_|jj�t|dddt�|_|jjdddt	�i|_
d|_dS(Ntborderwidthitrelieftexpanditfill(tNonetTktToplevelttoptFrametbuttonframetpacktGROOVEt
panelframetBOTHtpanelstcurpanel(tselfR	tmaster((s1/usr/lib64/python2.7/Demo/tkinter/guido/switch.pyt__init__s	
	cCs�t|jd|d||d��}|jdt�t|j�}||�}|||f|j|<|jdkr�|j	|�ndS(NttexttcommandcSs
|j|�S(N(tshow(Rtname((s1/usr/lib64/python2.7/Demo/tkinter/guido/switch.pyt<lambda>ttside(
tButtonRRtLEFTR
RRRRR(RRtklasstbuttontframetinstance((s1/usr/lib64/python2.7/Demo/tkinter/guido/switch.pytaddpanelscCsR|j|\}}}|jr/|jj�n||_|jdddd�dS(NRiRtboth(RRtpack_forgetR(RRRR R!((s1/usr/lib64/python2.7/Demo/tkinter/guido/switch.pyRs
		N(t__name__t
__module__RRR"R(((s1/usr/lib64/python2.7/Demo/tkinter/guido/switch.pyRs	
t
LabelPanelcBseZd�ZRS(cCs&t|dd�|_|jj�dS(NRsHello world(tLabeltlabelR(RR ((s1/usr/lib64/python2.7/Demo/tkinter/guido/switch.pyR's(R%R&R(((s1/usr/lib64/python2.7/Demo/tkinter/guido/switch.pyR'&stButtonPanelcBseZd�ZRS(cCs&t|dd�|_|jj�dS(NRsPress me(RRR(RR ((s1/usr/lib64/python2.7/Demo/tkinter/guido/switch.pyR,s(R%R&R(((s1/usr/lib64/python2.7/Demo/tkinter/guido/switch.pyR*+scCs:t�}|jdt�|jdt�|jj�dS(NR)R(RR"R'R*R	tmainloop(tapp((s1/usr/lib64/python2.7/Demo/tkinter/guido/switch.pytmain0s	t__main__N((((tTkinterRR'R*R-R%(((s1/usr/lib64/python2.7/Demo/tkinter/guido/switch.pyt<module>s
!	PK�
Q\�`&�CCguido/brownian.pynu�[���# Brownian motion -- an example of a multi-threaded Tkinter program.

from Tkinter import *
import random
import threading
import time
import sys

WIDTH = 400
HEIGHT = 300
SIGMA = 10
BUZZ = 2
RADIUS = 2
LAMBDA = 10
FILL = 'red'

stop = 0                                # Set when main loop exits

def particle(canvas):
    r = RADIUS
    x = random.gauss(WIDTH/2.0, SIGMA)
    y = random.gauss(HEIGHT/2.0, SIGMA)
    p = canvas.create_oval(x-r, y-r, x+r, y+r, fill=FILL)
    while not stop:
        dx = random.gauss(0, BUZZ)
        dy = random.gauss(0, BUZZ)
        dt = random.expovariate(LAMBDA)
        try:
            canvas.move(p, dx, dy)
        except TclError:
            break
        time.sleep(dt)

def main():
    global stop
    root = Tk()
    canvas = Canvas(root, width=WIDTH, height=HEIGHT)
    canvas.pack(fill='both', expand=1)
    np = 30
    if sys.argv[1:]:
        np = int(sys.argv[1])
    for i in range(np):
        t = threading.Thread(target=particle, args=(canvas,))
        t.start()
    try:
        root.mainloop()
    finally:
        stop = 1

main()
PK�
Q\KѴ�Q�Qguido/solitaire.pycnu�[����
Afc@sCdZddlZddlZddlTddlmZmZmZmZdefd��YZdZ	dZ
d	Ze	d
eZe
deZ
dZd
ZdZdZdZdZdZdZiZxeefD]Zeee<q�WxeefD]Zeee<q�Wej�Zee�ZdZdZdZdZe dd�Z!ee!�Z"ddge#e$e d
d��dddgZ%dZ&dd0d ��YZ'd!d1d"��YZ(d#e(fd$��YZ)d%�Z*d&e(fd'��YZ+d(e+fd)��YZ,d*e+fd+��YZ-d,d2d-��YZ.d.�Z/e0d/kr?e/�ndS(3s�Solitaire game, much like the one that comes with MS Windows.

Limitations:

- No cute graphical images for the playing cards faces or backs.
- No scoring or timer.
- No undo.
- No option to turn 3 cards at a time.
- No keyboard shortcuts.
- Less fancy animation when you win.
- The determination of which stack you drag to is more relaxed.

Apology:

I'm not much of a card player, so my terminology in these comments may
at times be a little unusual.  If you have suggestions, please let me
know!

i����N(t*(t	Rectanglet
CanvasTexttGrouptWindowRcBseZddd�ZRS(cCs|jj|j||�S(N(tcanvasttag_bindtid(tselftsequencetcommand((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pytbind%sN(t__name__t
__module__tNoneR(((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyR$sidi�i
iiis#070tHearttDiamondtClubtSpadetredtblackiiii
ittAtJtQtKitCardcBsMeZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	RS(s�A playing card.

    A card doesn't record to which stack it belongs; only the stack
    records this (it turns out that we always know this from the
    context, and this saves a ``double update'' with potential for
    inconsistencies).

    Public methods:

    moveto(x, y) -- move the card to an absolute position
    moveby(dx, dy) -- move the card by a relative offset
    tkraise() -- raise the card to the top of its stack
    showface(), showback() -- turn the card face up or down & raise it

    Public read-only instance variables:

    suit, value, color -- the card's suit, value and color
    face_shown -- true when the card is shown face up, else false

    Semi-public read-only instance variables (XXX should be made
    private):

    group -- the Canvas.Group representing the card
    x, y -- the position of the card's top left corner

    Private instance variables:

    __back, __rect, __text -- the canvas items making up the card

    (To show the card face up, the text item is placed in front of
    rect and the back is placed behind it.  To show it face down, this
    is reversed.  The card is created face down.)

    c
Cs||_||_t||_d|_d|_|_t|�|_dt	||f}t
|tdddtd|jd|�|_
|jj|j
�t|ddttdddd	�|_|jj|j�t|ttttttdddd
�|_|jj|j�dS(sCard constructor.

        Arguments are the card's suit and value, and the canvas widget.

        The card is created at position (0, 0), with its face down
        (adding it to a stack will position it according to that
        stack's rules).

        is%s  %sitanchortfillttexttoutlineRtwhitetblueN(tsuittvaluetCOLORtcolort
face_showntxtyRtgrouptVALNAMESRt	CARDWIDTHtNt_Card__texttaddtag_withtagRt
CARDHEIGHTt_Card__recttMARGINt_Card__back(RR!R"RR((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyt__init__�s"
		
	cCsd|j|jfS(s+Return a string for debug print statements.sCard(%r, %r)(R!R"(R((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyt__repr__�scCs"|j||j||j�dS(s*Move the card to absolute position (x, y).N(tmovebyR&R'(RR&R'((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pytmoveto�scCs7|j||_|j||_|jj||�dS(sMove the card by (dx, dy).N(R&R'R(tmove(Rtdxtdy((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyR4�scCs|jj�dS(s5Raise the card above all other objects in its canvas.N(R(ttkraise(R((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyR9�scCs1|j�|jj�|jj�d|_dS(sTurn the card's face up.iN(R9R/R,R%(R((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pytshowface�s


cCs1|j�|jj�|jj�d|_dS(sTurn the card's face down.iN(R9R/R1R%(R((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pytshowback�s


(
RR
t__doc__R2R3R5R4R9R:R;(((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRss#	 					tStackcBs�eZdZdd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
d�Zd�Zd
�Zd�Zd�ZdZd�Zd�Zd�ZRS(s�A generic stack of cards.

    This is used as a base class for all other stacks (e.g. the deck,
    the suit stacks, and the row stacks).

    Public methods:

    add(card) -- add a card to the stack
    delete(card) -- delete a card from the stack
    showtop() -- show the top card (if any) face up
    deal() -- delete and return the top card, or None if empty

    Method that subclasses may override:

    position(card) -- move the card to its proper (x, y) position

        The default position() method places all cards at the stack's
        own (x, y) position.

    userclickhandler(), userdoubleclickhandler() -- called to do
    subclass specific things on single and double clicks

        The default user (single) click handler shows the top card
        face up.  The default user double click handler calls the user
        single click handler.

    usermovehandler(cards) -- called to complete a subpile move

        The default user move handler moves all moved cards back to
        their original position (by calling the position() method).

    Private methods:

    clickhandler(event), doubleclickhandler(event),
    motionhandler(event), releasehandler(event) -- event handlers

        The default event handlers turn the top card of the stack with
        its face up on a (single or double) click, and also support
        moving a subpile around.

    startmoving(event) -- begin a move operation
    finishmoving() -- finish a move operation

    cCs�||_||_||_g|_t|jj�|_|jjd|j�|jjd|j	�|jjd|j
�|jjd|j�|j�dS(sStack constructor.

        Arguments are the stack's nominal x and y position (the top
        left corner of the first card placed in the stack), and the
        game object (which is used to get the canvas; subclasses use
        the game object to find other stacks).

        s<1>s
<Double-1>s<B1-Motion>s<ButtonRelease-1>N(
R&R'tgametcardsRRR(Rtclickhandlertdoubleclickhandlert
motionhandlertreleasehandlert
makebottom(RR&R'R>((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyR2s					cCsdS(N((R((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRDscCsd|jj|j|jfS(s+Return a string for debug print statements.s
%s(%d, %d)(t	__class__RR&R'(R((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyR3scCs>|jj|�|j�|j|�|jj|j�dS(N(R?tappendR9tpositionR(R-(Rtcard((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pytadd%s

cCs'|jj|�|jj|j�dS(N(R?tremoveR(tdtag(RRH((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pytdelete+scCs!|jr|jdj�ndS(Ni����(R?R:(R((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pytshowtop/s	cCs+|js
dS|jd}|j|�|S(Ni����(R?RRL(RRH((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pytdeal3s
	

cCs|j|j|j�dS(N(R5R&R'(RRH((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRG<scCs|j�dS(N(RM(R((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pytuserclickhandler?scCs|j�dS(N(RO(R((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pytuserdoubleclickhandlerBscCs"x|D]}|j|�qWdS(N(RG(RR?RH((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pytusermovehandlerEs
cCs%|j�|j�|j|�dS(N(tfinishmovingROtstartmoving(Rtevent((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyR@Ks

cCs|j|�dS(N(t
keepmoving(RRT((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRBPscCs|j|�|j�dS(N(RURR(RRT((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRCSs
cCs%|j�|j�|j|�dS(N(RRRPRS(RRT((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRAWs

cCs�d|_|jjjd�}xDtt|j��D])}|j|}|jj	|kr4Pq4q4WdS|j
srdS|j||_|j|_|j
|_x|jD]}|j�q�WdS(Ntcurrent(RtmovingR>RtgettagstrangetlenR?R(ttagR%R&tlastxR'tlastyR9(RRTttagstiRH((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRS`s	
	cCs||js
dS|j|j}|j|j}|j|_|j|_|sQ|rxx$|jD]}|j||�q[WndS(N(RWR&R\R'R]R4(RRTR7R8RH((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRUqs	cCs,|j}d|_|r(|j|�ndS(N(RWRRQ(RR?((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRR|s		N(RR
R<RR2RDR3RIRLRMRNRGRORPRQR@RBRCRARWRSRURR(((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyR=�s(-																	tDeckcBs2eZdZd�Zd�Zd�Zd�ZRS(s7The deck is a stack with support for shuffling.

    New methods:

    fill() -- create the playing cards
    shuffle() -- shuffle the playing cards

    A single click moves the top card to the game's open deck and
    moves it face up; if we're out of cards, it moves the open deck
    back to the deck.

    c
CsRt|jj|j|j|jt|jtdddt�}|jj	|�dS(NRRR(
RR>RR&R'R*R.t
BACKGROUNDR(R-(Rtbottom((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRD�s
cCsEx>tD]6}x-tD]%}|jt|||jj��qWqWdS(N(tALLSUITSt	ALLVALUESRIRR>R(RR!R"((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyR�s

cCsMt|j�}g}x(t|�D]}|j|j|�q"W||_dS(N(RZR?trandpermRF(RtntnewcardsR_((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pytshuffle�s
cCsv|jj}|j�}|sUxQ|j�}|s7Pn|j|�|j�q!Wn|jjj|�|j�dS(N(R>topendeckRNRIR;R:(RRiRH((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRO�s
(RR
R<RDRRhRO(((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyR`�s

			cCsLt|�}g}x3|rGtj|�}|j|�|j|�qW|S(s4Function returning a random permutation of range(n).(RYtrandomtchoiceRFRJ(RftrR&R_((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRe�s	
t	OpenStackcBs#eZd�Zd�Zd�ZRS(cCsdS(Ni((RR?((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyt
acceptable�scCs�|d}|jj|�}|s?||ks?|j|�rRtj||�n8x(|D] }|j|�|j|�qYW|jj�dS(Ni(R>tcloseststackRnR=RQRLRItwincheck(RR?RHtstack((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRQ�s
#

cCs�|js
dS|jd}|js1|j�dSxQ|jjD]C}|j|g�r>|j|�|j|�|jj�Pq>q>WdS(Ni����(	R?R%ROR>tsuitsRnRLRIRp(RRHts((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRP�s	
	



(RR
RnRQRP(((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRm�s		t	SuitStackcBs,eZd�Zd�Zd�Zd�ZRS(c
CsBt|jj|j|j|jt|jtdddd�}dS(NRRRR(RR>RR&R'R*R.(RRb((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRD�scCsdS(N((R((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRO�scCsdS(N((R((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRP�scCsit|�dkrdS|d}|js6|jtkS|jd}|j|jkoh|j|jdkS(Niii����(RZR?R"tACER!(RR?RHttopcard((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRn�s
	

(RR
RDRORPRn(((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRt�s			tRowStackcBseZd�Zd�ZRS(cCs`|d}|js |jtkS|jd}|js:dS|j|jko_|j|jdkS(Nii����i(R?R"tKINGR%R$(RR?RHRv((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRn�s
	

	cCsh|j}xE|jD]:}||kr)Pn|jrC|dt}q|t}qW|j|j|�dS(Ni(R'R?R%R0tOFFSETR5R&(RRHR'tc((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRGs		(RR
RnRG(((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRw�s		t	SolitairecBsGeZd�Zd�Zd�Zd�Zd�Zd�Zd�ZRS(cCs�||_t|jdtdddttddtdt�|_|jjdt	d	t
�t|jd
ddddtdd
d|j�|_
t|jtdtdd|j
dt�t}t}t|||�|_|t}t|||�|_|t}g|_x:tt�D],}|t}|jjt|||��qWt}|t}g|_x:tt�D],}|jjt|||��|t}qoW|jg|j|j|_|jj�|j�dS(Nt
backgroundthighlightthicknessitwidththeightiiRtexpandRtDealtactivebackgroundtgreenR
twindowR(tmastertCanvasRatNROWStXSPACINGtYSPACINGR0RtpacktBOTHtTRUEtButtonRNt
dealbuttonRtSWR`tdeckRmRiRrRYtNSUITSRFRttrowsRwt
openstacksR(RR�R&R'R_((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyR2sD	


	
 
	
cCsEx*|jD]}t|j�tkr
dSq
W|j�|j�dS(N(RrRZR?tNVALUEStwinRN(RRs((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRp=s

cCsgg}x|jD]}||j}qWx9|rbtj|�}|j|�|j||j�q*WdS(sStupid animation when you win.N(R�R?RjRkRJtanimatedmovetoR�(RR?RsRH((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyR�Ds	
cCsgx`tddd�D]L}|j|j||j|j|}}|j||�|jj�qWdS(Ni
ii����(RYR&R'R4R�tupdate_idletasks(RRHtdestR_R7R8((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyR�Ns)cCsed}d}xR|jD]G}|j|jd|j|jd}||kr|}|}qqW|S(Ni�ɚ;i(RR�R&R'(RRHtclosesttcdistRqtdist((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRoTs&
cCs�|j�|jj�xHtt�D]:}x1|j|D]"}|jj�}|j|�q8Wq$Wx|jD]}|j�qlWdS(N(	tresetR�RhRYR�R�RNRIRM(RR_RlRH((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyRN`s

cCsOxH|jD]=}x4|j�}|s)Pn|jj|�|j�qWq
WdS(N(R�RNR�RIR;(RRqRH((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyR�js(	RR
R2RpR�R�RoRNR�(((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyR{
s	.		
			
cCs6t�}t|�}|jd|j�|j�dS(NtWM_DELETE_WINDOW(tTkR{tprotocoltquittmainloop(trootR>((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pytmainvs	t__main__((((1R<tmathRjtTkinterR�RRRRR*R.R0R�R�RyRatHEARTStDIAMONDStCLUBStSPADEStREDtBLACKR#RstkeysRcRZR�RutJACKtQUEENRxRYRdR�tmaptstrR)R�RR=R`ReRmRtRwR{R�R(((s4/usr/lib64/python2.7/Demo/tkinter/guido/solitaire.pyt<module>sX
"
/f�1	i	PK�
Q\���ooguido/dialog.pyonu�[����
Afc@sKddlTddlZd�Zd�Zd�ZedkrGe�ndS(i����(t*NcGs�t|dd�}|j|�|jd�t|dtdd�}|jdtdt�t|dtdd�}|jdtdt�t	|dd	d
|dd�}	|	jdt
d
ddtdddd�|rt|d|�}
|
jdtdddd�nt
�}g}d}
x�|D]�}t|d
|d||
d��}|j|�|
|kr�t|dtdd�}|jdtd
ddddd�|j�|jd|dtdddddddd�n.|jdtd
ddddddddd�|
d}
q!W|dkrA|jd||||d��n|j�}|j�|j�|j|�|j�|r�|j�n|j�S(Ntclass_tDialogtrelieftborderwidthitsidetfilltwidtht3ittexttfonts$-Adobe-Times-Medium-R-Normal-*-180-*texpandtpadxt3mtpadytbitmapitcommandcSs
|j|�S(N(tset(tvti((s1/usr/lib64/python2.7/Demo/tkinter/guido/dialog.pyt<lambda>(tt2mtin_tipadxtipadyt1ms<Return>cSs|j�|j|�fS(N(tflashR(tetbRR((s1/usr/lib64/python2.7/Demo/tkinter/guido/dialog.pyR:s	(tToplevelttitleticonnametFrametRAISEDtpacktTOPtBOTHtBOTTOMtMessagetRIGHTtLabeltLEFTtIntVartButtontappendtSUNKENtlifttbindt	focus_gettgrab_sett	focus_settwaitvartdestroytget(tmasterRR	RtdefaulttargstwttoptbottmsgtbmtvartbuttonsRtbutRtbdtoldFocus((s1/usr/lib64/python2.7/Demo/tkinter/guido/dialog.pytdialogsN

	(	
!
"
	




c	CsRttddddd�}dG|GHttddd	d
ddd
�}dG|GHdS(NsNot Respondings=The file server isn't responding right now; I'll keep trying.Ri����tOKspressed buttons
File ModifiedswFile "tcl.h" has been modified since the last time it was saved. Do you want to save it before exiting the application?twarningis	Save FilesDiscard ChangessReturn To Editor(RDt
mainWidget(R((s1/usr/lib64/python2.7/Demo/tkinter/guido/dialog.pytgoLs 			cCs}ddl}t�atjt�ttdddt�}|j�ttddd|j�}|jdt	�tj
�dS(Ni����R	sPress Here To StartRtExitR(tsysR!RGtPacktconfigR,RHR#texitR%tmainloop(RJtstarttendit((s1/usr/lib64/python2.7/Demo/tkinter/guido/dialog.pyttestas	

t__main__(tTkinterRJRDRHRQt__name__(((s1/usr/lib64/python2.7/Demo/tkinter/guido/dialog.pyt<module>s
	A		PK�
Q\�<J=guido/svkill.pynuȯ��#! /usr/bin/python2.7

# Tkinter interface to SYSV `ps' and `kill' commands.

from Tkinter import *

if TkVersion < 4.0:
    raise ImportError, "This version of svkill requires Tk 4.0 or later"

from string import splitfields
from string import split
import commands
import os

user = os.environ['LOGNAME']

class BarButton(Menubutton):
    def __init__(self, master=None, **cnf):
        apply(Menubutton.__init__, (self, master), cnf)
        self.pack(side=LEFT)
        self.menu = Menu(self, name='menu')
        self['menu'] = self.menu

class Kill(Frame):
    # List of (name, option, pid_column)
    view_list = [
            ('Default', ''),
            ('Every (-e)', '-e'),
            ('Non process group leaders (-d)', '-d'),
            ('Non leaders with tty (-a)', '-a'),
            ('For this user (-u %s)' % user, '-u %s' % user),
            ]
    format_list = [
            ('Default', '', 0),
            ('Long (-l)', '-l', 3),
            ('Full (-f)', '-f', 1),
            ('Full Long (-f -l)', '-l -f', 3),
            ('Session and group ID (-j)', '-j', 0),
            ('Scheduler properties (-c)', '-c', 0),
            ]
    def kill(self, selected):
        c = self.format_list[self.format.get()][2]
        pid = split(selected)[c]
        os.system('kill -9 ' + pid)
        self.do_update()
    def do_update(self):
        format = self.format_list[self.format.get()][1]
        view = self.view_list[self.view.get()][1]
        s = commands.getoutput('ps %s %s' % (view, format))
        list = splitfields(s, '\n')
        self.header.set(list[0] + '          ')
        del list[0]
        self.frame.list.delete(0, AtEnd())
        for line in list:
            self.frame.list.insert(0, line)
    def do_motion(self, e):
        e.widget.select_clear('0', 'end')
        e.widget.select_set(e.widget.nearest(e.y))
    def do_leave(self, e):
        e.widget.select_clear('0', 'end')
    def do_1(self, e):
        self.kill(e.widget.get(e.widget.nearest(e.y)))
    def __init__(self, master=None, **cnf):
        apply(Frame.__init__, (self, master), cnf)
        self.pack(expand=1, fill=BOTH)
        self.bar = Frame(self, name='bar', relief=RAISED,
                         borderwidth=2)
        self.bar.pack(fill=X)
        self.bar.file = BarButton(self.bar, text='File')
        self.bar.file.menu.add_command(
                label='Quit', command=self.quit)
        self.bar.view = BarButton(self.bar, text='View')
        self.bar.format = BarButton(self.bar, text='Format')
        self.view = IntVar(self)
        self.view.set(0)
        self.format = IntVar(self)
        self.format.set(0)
        for num in range(len(self.view_list)):
            label, option = self.view_list[num]
            self.bar.view.menu.add_radiobutton(
                    label=label,
                    command=self.do_update,
                    variable=self.view,
                    value=num)
        for num in range(len(self.format_list)):
            label, option, col = self.format_list[num]
            self.bar.format.menu.add_radiobutton(
                    label=label,
                    command=self.do_update,
                    variable=self.format,
                    value=num)
        self.bar.tk_menuBar(self.bar.file,
                            self.bar.view,
                            self.bar.format)
        self.frame = Frame(self, relief=RAISED, borderwidth=2)
        self.frame.pack(expand=1, fill=BOTH)
        self.header = StringVar(self)
        self.frame.label = Label(
                self.frame, relief=FLAT, anchor=NW, borderwidth=0,
                font='*-Courier-Bold-R-Normal-*-120-*',
                textvariable=self.header)
        self.frame.label.pack(fill=Y, anchor=W)
        self.frame.vscroll = Scrollbar(self.frame, orient=VERTICAL)
        self.frame.list = Listbox(
                self.frame,
                relief=SUNKEN,
                font='*-Courier-Medium-R-Normal-*-120-*',
                width=40, height=10,
                selectbackground='#eed5b7',
                selectborderwidth=0,
                selectmode=BROWSE,
                yscroll=self.frame.vscroll.set)
        self.frame.vscroll['command'] = self.frame.list.yview
        self.frame.vscroll.pack(side=RIGHT, fill=Y)
        self.frame.list.pack(expand=1, fill=BOTH)
        self.update = Button(self, text='Update',
                             command=self.do_update)
        self.update.pack(fill=X)
        self.frame.list.bind('<Motion>', self.do_motion)
        self.frame.list.bind('<Leave>', self.do_leave)
        self.frame.list.bind('<1>', self.do_1)
        self.do_update()

if __name__ == '__main__':
    kill = Kill(None, borderwidth=5)
    kill.winfo_toplevel().title('Tkinter Process Killer (SYSV)')
    kill.winfo_toplevel().minsize(1, 1)
    kill.mainloop()
PK�
Q\�^u�iiguido/switch.pyonu�[����
��^c@sfddlTddd��YZddd��YZdd
d��YZd�Zed	krbe�nd
S(i����(t*tAppcBs)eZddd�Zd�Zd�ZRS(cCs�|dkr3|dkr$t�}q3t|�}n||_t|�|_|jj�t|dddt�|_|jjdddt	�i|_
d|_dS(Ntborderwidthitrelieftexpanditfill(tNonetTktToplevelttoptFrametbuttonframetpacktGROOVEt
panelframetBOTHtpanelstcurpanel(tselfR	tmaster((s1/usr/lib64/python2.7/Demo/tkinter/guido/switch.pyt__init__s	
	cCs�t|jd|d||d��}|jdt�t|j�}||�}|||f|j|<|jdkr�|j	|�ndS(NttexttcommandcSs
|j|�S(N(tshow(Rtname((s1/usr/lib64/python2.7/Demo/tkinter/guido/switch.pyt<lambda>ttside(
tButtonRRtLEFTR
RRRRR(RRtklasstbuttontframetinstance((s1/usr/lib64/python2.7/Demo/tkinter/guido/switch.pytaddpanelscCsR|j|\}}}|jr/|jj�n||_|jdddd�dS(NRiRtboth(RRtpack_forgetR(RRRR R!((s1/usr/lib64/python2.7/Demo/tkinter/guido/switch.pyRs
		N(t__name__t
__module__RRR"R(((s1/usr/lib64/python2.7/Demo/tkinter/guido/switch.pyRs	
t
LabelPanelcBseZd�ZRS(cCs&t|dd�|_|jj�dS(NRsHello world(tLabeltlabelR(RR ((s1/usr/lib64/python2.7/Demo/tkinter/guido/switch.pyR's(R%R&R(((s1/usr/lib64/python2.7/Demo/tkinter/guido/switch.pyR'&stButtonPanelcBseZd�ZRS(cCs&t|dd�|_|jj�dS(NRsPress me(RRR(RR ((s1/usr/lib64/python2.7/Demo/tkinter/guido/switch.pyR,s(R%R&R(((s1/usr/lib64/python2.7/Demo/tkinter/guido/switch.pyR*+scCs:t�}|jdt�|jdt�|jj�dS(NR)R(RR"R'R*R	tmainloop(tapp((s1/usr/lib64/python2.7/Demo/tkinter/guido/switch.pytmain0s	t__main__N((((tTkinterRR'R*R-R%(((s1/usr/lib64/python2.7/Demo/tkinter/guido/switch.pyt<module>s
!	PK�
Q\E`}eR	R	guido/electrons.pyonu�[����
Afc@sLddlTddlZddd��YZd�ZedkrHe�ndS(i����(t*Nt	ElectronscBs&eZdd�Zd�Zd�ZRS(c
Cs||_t�|_}t|�|_}|j�|j|d�|j|d�}}|r�|j|d|dd|dd�|_ng|_	d
\}}}	}
xWt
|�D]I}|j|||	|
dd�}|j	j|�|d|
d}}
q�W|jj
�dS(Ntwidththeightitbitmapt
foregroundtbluei
iFiiJtfilltred(i
iFiiJ(tntTkttktCanvastcanvastpacktgetintt
create_bitmapRtpiecestrangetcreate_ovaltappendtupdate(
tselfR	RRtcRRtx1ty1tx2ty2titp((s4/usr/lib64/python2.7/Demo/tkinter/guido/electrons.pyt__init__s 	
'	cCsq|j}xT|jD]I}tjtdd��}tjtdd��}|j|||�qW|jj�dS(Ni����ii����(R
RtrandomtchoiceRtmoveRR(RR	RRtxty((s4/usr/lib64/python2.7/Demo/tkinter/guido/electrons.pytrandom_move+s	cCshy+x$td�D]}|j|j�qWWn6tk
rcy|jj�Wqdtk
r_qdXnXdS(Ni�(RR$R	tTclErrorRtdestroy(RR((s4/usr/lib64/python2.7/Demo/tkinter/guido/electrons.pytrun4s

N(t__name__t
__module__tNoneRR$R'(((s4/usr/lib64/python2.7/Demo/tkinter/guido/electrons.pyRs		cCs�ddl}ddl}|jdr>|j|jd�}nd}|jdr�|jd}|ddkr{|d}q�d|}nd}t||�}|j�dS(Ni����iiiit@(tsyststringtargvtatoiR*RR'(R,R-R	Rth((s4/usr/lib64/python2.7/Demo/tkinter/guido/electrons.pytmain@s




t__main__((tTkinterRRR1R((((s4/usr/lib64/python2.7/Demo/tkinter/guido/electrons.pyt<module>s

-	PK�
Q\��|
��guido/MimeViewer.pynuȯ��#! /usr/bin/python2.7

# View a single MIME multipart message.
# Display each part as a box.

import string
from types import *
from Tkinter import *
from ScrolledText import ScrolledText

class MimeViewer:
    def __init__(self, parent, title, msg):
        self.title = title
        self.msg = msg
        self.frame = Frame(parent, {'relief': 'raised', 'bd': 2})
        self.frame.packing = {'expand': 0, 'fill': 'both'}
        self.button = Checkbutton(self.frame,
                             {'text': title,
                              'command': self.toggle})
        self.button.pack({'anchor': 'w'})
        headertext = msg.getheadertext(
                lambda x: x != 'received' and x[:5] != 'x400-')
        height = countlines(headertext, 4)
        if height:
            self.htext = ScrolledText(self.frame,
                              {'height': height,
                               'width': 80,
                               'wrap': 'none',
                               'relief': 'raised',
                               'bd': 2})
            self.htext.packing = {'expand': 1, 'fill': 'both',
                                  'after': self.button}
            self.htext.insert('end', headertext)
        else:
            self.htext = Frame(self.frame,
                               {'relief': 'raised', 'bd': 2})
            self.htext.packing = {'side': 'top',
                                  'ipady': 2,
                                  'fill': 'x',
                                  'after': self.button}
        body = msg.getbody()
        if type(body) == StringType:
            self.pad = None
            height = countlines(body, 10)
            if height:
                self.btext = ScrolledText(self.frame,
                                  {'height': height,
                                   'width': 80,
                                   'wrap': 'none',
                                   'relief': 'raised',
                                   'bd': 2})
                self.btext.packing = {'expand': 1,
                                      'fill': 'both'}
                self.btext.insert('end', body)
            else:
                self.btext = None
            self.parts = None
        else:
            self.pad = Frame(self.frame,
                             {'relief': 'flat', 'bd': 2})
            self.pad.packing = {'side': 'left', 'ipadx': 10,
                                'fill': 'y', 'after': self.htext}
            self.parts = []
            for i in range(len(body)):
                p = MimeViewer(self.frame,
                               '%s.%d' % (title, i+1),
                               body[i])
                self.parts.append(p)
            self.btext = None
        self.collapsed = 1
    def pack(self):
        self.frame.pack(self.frame.packing)
    def destroy(self):
        self.frame.destroy()
    def show(self):
        if self.collapsed:
            self.button.invoke()
    def toggle(self):
        if self.collapsed:
            self.explode()
        else:
            self.collapse()
    def collapse(self):
        self.collapsed = 1
        for comp in self.htext, self.btext, self.pad:
            if comp:
                comp.forget()
        if self.parts:
            for part in self.parts:
                part.frame.forget()
        self.frame.pack({'expand': 0})
    def explode(self):
        self.collapsed = 0
        for comp in self.htext, self.btext, self.pad:
            if comp: comp.pack(comp.packing)
        if self.parts:
            for part in self.parts:
                part.pack()
        self.frame.pack({'expand': 1})

def countlines(str, limit):
    i = 0
    n = 0
    while  n < limit:
        i = string.find(str, '\n', i)
        if i < 0: break
        n = n+1
        i = i+1
    return n

def main():
    import sys
    import getopt
    import mhlib
    opts, args = getopt.getopt(sys.argv[1:], '')
    for o, a in opts:
        pass
    message = None
    folder = 'inbox'
    for arg in args:
        if arg[:1] == '+':
            folder = arg[1:]
        else:
            message = string.atoi(arg)

    mh = mhlib.MH()
    f = mh.openfolder(folder)
    if not message:
        message = f.getcurrent()
    m = f.openmessage(message)

    root = Tk()
    tk = root.tk

    top = MimeViewer(root, '+%s/%d' % (folder, message), m)
    top.pack()
    top.show()

    root.minsize(1, 1)

    tk.mainloop()

if __name__ == '__main__': main()
PK�
Q\j'��guido/imagedraw.pynu�[���"""Draw on top of an image"""

from Tkinter import *
import sys

def main():
    filename = sys.argv[1]
    root = Tk()
    img = PhotoImage(file=filename)
    w, h = img.width(), img.height()
    canv = Canvas(root, width=w, height=h)
    canv.create_image(0, 0, anchor=NW, image=img)
    canv.pack()
    canv.bind('<Button-1>', blob)
    root.mainloop()

def blob(event):
    x, y = event.x, event.y
    canv = event.widget
    r = 5
    canv.create_oval(x-r, y-r, x+r, y+r, fill='red', outline="")

main()
PK�
Q\��1guido/switch.pynu�[���# Show how to do switchable panels.

from Tkinter import *

class App:

    def __init__(self, top=None, master=None):
        if top is None:
            if master is None:
                top = Tk()
            else:
                top = Toplevel(master)
        self.top = top
        self.buttonframe = Frame(top)
        self.buttonframe.pack()
        self.panelframe = Frame(top,  borderwidth=2, relief=GROOVE)
        self.panelframe.pack(expand=1, fill=BOTH)
        self.panels = {}
        self.curpanel = None

    def addpanel(self, name, klass):
        button = Button(self.buttonframe, text=name,
                        command=lambda self=self, name=name: self.show(name))
        button.pack(side=LEFT)
        frame = Frame(self.panelframe)
        instance = klass(frame)
        self.panels[name] = (button, frame, instance)
        if self.curpanel is None:
            self.show(name)

    def show(self, name):
        (button, frame, instance) = self.panels[name]
        if self.curpanel:
            self.curpanel.pack_forget()
        self.curpanel = frame
        frame.pack(expand=1, fill="both")

class LabelPanel:
    def __init__(self, frame):
        self.label = Label(frame, text="Hello world")
        self.label.pack()

class ButtonPanel:
    def __init__(self, frame):
        self.button = Button(frame, text="Press me")
        self.button.pack()

def main():
    app = App()
    app.addpanel("label", LabelPanel)
    app.addpanel("button", ButtonPanel)
    app.top.mainloop()

if __name__ == '__main__':
    main()
PK�
Q\.�V�oo
guido/wish.pynu�[���# This is about all it requires to write a wish shell in Python!

import _tkinter
import os

tk = _tkinter.create(os.environ['DISPLAY'], 'wish', 'Tk', 1)
tk.call('update')

cmd = ''

while 1:
    if cmd: prompt = ''
    else: prompt = '% '
    try:
        line = raw_input(prompt)
    except EOFError:
        break
    cmd = cmd + (line + '\n')
    if tk.getboolean(tk.call('info', 'complete', cmd)):
        tk.record(line)
        try:
            result = tk.call('eval', cmd)
        except _tkinter.TclError, msg:
            print 'TclError:', msg
        else:
            if result: print result
        cmd = ''
PK�
Q\&�S�}E}Eguido/solitaire.pynuȯ��#! /usr/bin/python2.7

"""Solitaire game, much like the one that comes with MS Windows.

Limitations:

- No cute graphical images for the playing cards faces or backs.
- No scoring or timer.
- No undo.
- No option to turn 3 cards at a time.
- No keyboard shortcuts.
- Less fancy animation when you win.
- The determination of which stack you drag to is more relaxed.

Apology:

I'm not much of a card player, so my terminology in these comments may
at times be a little unusual.  If you have suggestions, please let me
know!

"""

# Imports

import math
import random

from Tkinter import *
from Canvas import Rectangle, CanvasText, Group, Window


# Fix a bug in Canvas.Group as distributed in Python 1.4.  The
# distributed bind() method is broken.  Rather than asking you to fix
# the source, we fix it here by deriving a subclass:

class Group(Group):
    def bind(self, sequence=None, command=None):
        return self.canvas.tag_bind(self.id, sequence, command)


# Constants determining the size and lay-out of cards and stacks.  We
# work in a "grid" where each card/stack is surrounded by MARGIN
# pixels of space on each side, so adjacent stacks are separated by
# 2*MARGIN pixels.  OFFSET is the offset used for displaying the
# face down cards in the row stacks.

CARDWIDTH = 100
CARDHEIGHT = 150
MARGIN = 10
XSPACING = CARDWIDTH + 2*MARGIN
YSPACING = CARDHEIGHT + 4*MARGIN
OFFSET = 5

# The background color, green to look like a playing table.  The
# standard green is way too bright, and dark green is way to dark, so
# we use something in between.  (There are a few more colors that
# could be customized, but they are less controversial.)

BACKGROUND = '#070'


# Suits and colors.  The values of the symbolic suit names are the
# strings used to display them (you change these and VALNAMES to
# internationalize the game).  The COLOR dictionary maps suit names to
# colors (red and black) which must be Tk color names.  The keys() of
# the COLOR dictionary conveniently provides us with a list of all
# suits (in arbitrary order).

HEARTS = 'Heart'
DIAMONDS = 'Diamond'
CLUBS = 'Club'
SPADES = 'Spade'

RED = 'red'
BLACK = 'black'

COLOR = {}
for s in (HEARTS, DIAMONDS):
    COLOR[s] = RED
for s in (CLUBS, SPADES):
    COLOR[s] = BLACK

ALLSUITS = COLOR.keys()
NSUITS = len(ALLSUITS)


# Card values are 1-13.  We also define symbolic names for the picture
# cards.  ALLVALUES is a list of all card values.

ACE = 1
JACK = 11
QUEEN = 12
KING = 13
ALLVALUES = range(1, 14) # (one more than the highest value)
NVALUES = len(ALLVALUES)


# VALNAMES is a list that maps a card value to string.  It contains a
# dummy element at index 0 so it can be indexed directly with the card
# value.

VALNAMES = ["", "A"] + map(str, range(2, 11)) + ["J", "Q", "K"]


# Solitaire constants.  The only one I can think of is the number of
# row stacks.

NROWS = 7


# The rest of the program consists of class definitions.  These are
# further described in their documentation strings.


class Card:

    """A playing card.

    A card doesn't record to which stack it belongs; only the stack
    records this (it turns out that we always know this from the
    context, and this saves a ``double update'' with potential for
    inconsistencies).

    Public methods:

    moveto(x, y) -- move the card to an absolute position
    moveby(dx, dy) -- move the card by a relative offset
    tkraise() -- raise the card to the top of its stack
    showface(), showback() -- turn the card face up or down & raise it

    Public read-only instance variables:

    suit, value, color -- the card's suit, value and color
    face_shown -- true when the card is shown face up, else false

    Semi-public read-only instance variables (XXX should be made
    private):

    group -- the Canvas.Group representing the card
    x, y -- the position of the card's top left corner

    Private instance variables:

    __back, __rect, __text -- the canvas items making up the card

    (To show the card face up, the text item is placed in front of
    rect and the back is placed behind it.  To show it face down, this
    is reversed.  The card is created face down.)

    """

    def __init__(self, suit, value, canvas):
        """Card constructor.

        Arguments are the card's suit and value, and the canvas widget.

        The card is created at position (0, 0), with its face down
        (adding it to a stack will position it according to that
        stack's rules).

        """
        self.suit = suit
        self.value = value
        self.color = COLOR[suit]
        self.face_shown = 0

        self.x = self.y = 0
        self.group = Group(canvas)

        text = "%s  %s" % (VALNAMES[value], suit)
        self.__text = CanvasText(canvas, CARDWIDTH//2, 0,
                               anchor=N, fill=self.color, text=text)
        self.group.addtag_withtag(self.__text)

        self.__rect = Rectangle(canvas, 0, 0, CARDWIDTH, CARDHEIGHT,
                              outline='black', fill='white')
        self.group.addtag_withtag(self.__rect)

        self.__back = Rectangle(canvas, MARGIN, MARGIN,
                              CARDWIDTH-MARGIN, CARDHEIGHT-MARGIN,
                              outline='black', fill='blue')
        self.group.addtag_withtag(self.__back)

    def __repr__(self):
        """Return a string for debug print statements."""
        return "Card(%r, %r)" % (self.suit, self.value)

    def moveto(self, x, y):
        """Move the card to absolute position (x, y)."""
        self.moveby(x - self.x, y - self.y)

    def moveby(self, dx, dy):
        """Move the card by (dx, dy)."""
        self.x = self.x + dx
        self.y = self.y + dy
        self.group.move(dx, dy)

    def tkraise(self):
        """Raise the card above all other objects in its canvas."""
        self.group.tkraise()

    def showface(self):
        """Turn the card's face up."""
        self.tkraise()
        self.__rect.tkraise()
        self.__text.tkraise()
        self.face_shown = 1

    def showback(self):
        """Turn the card's face down."""
        self.tkraise()
        self.__rect.tkraise()
        self.__back.tkraise()
        self.face_shown = 0


class Stack:

    """A generic stack of cards.

    This is used as a base class for all other stacks (e.g. the deck,
    the suit stacks, and the row stacks).

    Public methods:

    add(card) -- add a card to the stack
    delete(card) -- delete a card from the stack
    showtop() -- show the top card (if any) face up
    deal() -- delete and return the top card, or None if empty

    Method that subclasses may override:

    position(card) -- move the card to its proper (x, y) position

        The default position() method places all cards at the stack's
        own (x, y) position.

    userclickhandler(), userdoubleclickhandler() -- called to do
    subclass specific things on single and double clicks

        The default user (single) click handler shows the top card
        face up.  The default user double click handler calls the user
        single click handler.

    usermovehandler(cards) -- called to complete a subpile move

        The default user move handler moves all moved cards back to
        their original position (by calling the position() method).

    Private methods:

    clickhandler(event), doubleclickhandler(event),
    motionhandler(event), releasehandler(event) -- event handlers

        The default event handlers turn the top card of the stack with
        its face up on a (single or double) click, and also support
        moving a subpile around.

    startmoving(event) -- begin a move operation
    finishmoving() -- finish a move operation

    """

    def __init__(self, x, y, game=None):
        """Stack constructor.

        Arguments are the stack's nominal x and y position (the top
        left corner of the first card placed in the stack), and the
        game object (which is used to get the canvas; subclasses use
        the game object to find other stacks).

        """
        self.x = x
        self.y = y
        self.game = game
        self.cards = []
        self.group = Group(self.game.canvas)
        self.group.bind('<1>', self.clickhandler)
        self.group.bind('<Double-1>', self.doubleclickhandler)
        self.group.bind('<B1-Motion>', self.motionhandler)
        self.group.bind('<ButtonRelease-1>', self.releasehandler)
        self.makebottom()

    def makebottom(self):
        pass

    def __repr__(self):
        """Return a string for debug print statements."""
        return "%s(%d, %d)" % (self.__class__.__name__, self.x, self.y)

    # Public methods

    def add(self, card):
        self.cards.append(card)
        card.tkraise()
        self.position(card)
        self.group.addtag_withtag(card.group)

    def delete(self, card):
        self.cards.remove(card)
        card.group.dtag(self.group)

    def showtop(self):
        if self.cards:
            self.cards[-1].showface()

    def deal(self):
        if not self.cards:
            return None
        card = self.cards[-1]
        self.delete(card)
        return card

    # Subclass overridable methods

    def position(self, card):
        card.moveto(self.x, self.y)

    def userclickhandler(self):
        self.showtop()

    def userdoubleclickhandler(self):
        self.userclickhandler()

    def usermovehandler(self, cards):
        for card in cards:
            self.position(card)

    # Event handlers

    def clickhandler(self, event):
        self.finishmoving()             # In case we lost an event
        self.userclickhandler()
        self.startmoving(event)

    def motionhandler(self, event):
        self.keepmoving(event)

    def releasehandler(self, event):
        self.keepmoving(event)
        self.finishmoving()

    def doubleclickhandler(self, event):
        self.finishmoving()             # In case we lost an event
        self.userdoubleclickhandler()
        self.startmoving(event)

    # Move internals

    moving = None

    def startmoving(self, event):
        self.moving = None
        tags = self.game.canvas.gettags('current')
        for i in range(len(self.cards)):
            card = self.cards[i]
            if card.group.tag in tags:
                break
        else:
            return
        if not card.face_shown:
            return
        self.moving = self.cards[i:]
        self.lastx = event.x
        self.lasty = event.y
        for card in self.moving:
            card.tkraise()

    def keepmoving(self, event):
        if not self.moving:
            return
        dx = event.x - self.lastx
        dy = event.y - self.lasty
        self.lastx = event.x
        self.lasty = event.y
        if dx or dy:
            for card in self.moving:
                card.moveby(dx, dy)

    def finishmoving(self):
        cards = self.moving
        self.moving = None
        if cards:
            self.usermovehandler(cards)


class Deck(Stack):

    """The deck is a stack with support for shuffling.

    New methods:

    fill() -- create the playing cards
    shuffle() -- shuffle the playing cards

    A single click moves the top card to the game's open deck and
    moves it face up; if we're out of cards, it moves the open deck
    back to the deck.

    """

    def makebottom(self):
        bottom = Rectangle(self.game.canvas,
                           self.x, self.y,
                           self.x+CARDWIDTH, self.y+CARDHEIGHT,
                           outline='black', fill=BACKGROUND)
        self.group.addtag_withtag(bottom)

    def fill(self):
        for suit in ALLSUITS:
            for value in ALLVALUES:
                self.add(Card(suit, value, self.game.canvas))

    def shuffle(self):
        n = len(self.cards)
        newcards = []
        for i in randperm(n):
            newcards.append(self.cards[i])
        self.cards = newcards

    def userclickhandler(self):
        opendeck = self.game.opendeck
        card = self.deal()
        if not card:
            while 1:
                card = opendeck.deal()
                if not card:
                    break
                self.add(card)
                card.showback()
        else:
            self.game.opendeck.add(card)
            card.showface()


def randperm(n):
    """Function returning a random permutation of range(n)."""
    r = range(n)
    x = []
    while r:
        i = random.choice(r)
        x.append(i)
        r.remove(i)
    return x


class OpenStack(Stack):

    def acceptable(self, cards):
        return 0

    def usermovehandler(self, cards):
        card = cards[0]
        stack = self.game.closeststack(card)
        if not stack or stack is self or not stack.acceptable(cards):
            Stack.usermovehandler(self, cards)
        else:
            for card in cards:
                self.delete(card)
                stack.add(card)
            self.game.wincheck()

    def userdoubleclickhandler(self):
        if not self.cards:
            return
        card = self.cards[-1]
        if not card.face_shown:
            self.userclickhandler()
            return
        for s in self.game.suits:
            if s.acceptable([card]):
                self.delete(card)
                s.add(card)
                self.game.wincheck()
                break


class SuitStack(OpenStack):

    def makebottom(self):
        bottom = Rectangle(self.game.canvas,
                           self.x, self.y,
                           self.x+CARDWIDTH, self.y+CARDHEIGHT,
                           outline='black', fill='')

    def userclickhandler(self):
        pass

    def userdoubleclickhandler(self):
        pass

    def acceptable(self, cards):
        if len(cards) != 1:
            return 0
        card = cards[0]
        if not self.cards:
            return card.value == ACE
        topcard = self.cards[-1]
        return card.suit == topcard.suit and card.value == topcard.value + 1


class RowStack(OpenStack):

    def acceptable(self, cards):
        card = cards[0]
        if not self.cards:
            return card.value == KING
        topcard = self.cards[-1]
        if not topcard.face_shown:
            return 0
        return card.color != topcard.color and card.value == topcard.value - 1

    def position(self, card):
        y = self.y
        for c in self.cards:
            if c == card:
                break
            if c.face_shown:
                y = y + 2*MARGIN
            else:
                y = y + OFFSET
        card.moveto(self.x, y)


class Solitaire:

    def __init__(self, master):
        self.master = master

        self.canvas = Canvas(self.master,
                             background=BACKGROUND,
                             highlightthickness=0,
                             width=NROWS*XSPACING,
                             height=3*YSPACING + 20 + MARGIN)
        self.canvas.pack(fill=BOTH, expand=TRUE)

        self.dealbutton = Button(self.canvas,
                                 text="Deal",
                                 highlightthickness=0,
                                 background=BACKGROUND,
                                 activebackground="green",
                                 command=self.deal)
        Window(self.canvas, MARGIN, 3*YSPACING + 20,
               window=self.dealbutton, anchor=SW)

        x = MARGIN
        y = MARGIN

        self.deck = Deck(x, y, self)

        x = x + XSPACING
        self.opendeck = OpenStack(x, y, self)

        x = x + XSPACING
        self.suits = []
        for i in range(NSUITS):
            x = x + XSPACING
            self.suits.append(SuitStack(x, y, self))

        x = MARGIN
        y = y + YSPACING

        self.rows = []
        for i in range(NROWS):
            self.rows.append(RowStack(x, y, self))
            x = x + XSPACING

        self.openstacks = [self.opendeck] + self.suits + self.rows

        self.deck.fill()
        self.deal()

    def wincheck(self):
        for s in self.suits:
            if len(s.cards) != NVALUES:
                return
        self.win()
        self.deal()

    def win(self):
        """Stupid animation when you win."""
        cards = []
        for s in self.openstacks:
            cards = cards + s.cards
        while cards:
            card = random.choice(cards)
            cards.remove(card)
            self.animatedmoveto(card, self.deck)

    def animatedmoveto(self, card, dest):
        for i in range(10, 0, -1):
            dx, dy = (dest.x-card.x)//i, (dest.y-card.y)//i
            card.moveby(dx, dy)
            self.master.update_idletasks()

    def closeststack(self, card):
        closest = None
        cdist = 999999999
        # Since we only compare distances,
        # we don't bother to take the square root.
        for stack in self.openstacks:
            dist = (stack.x - card.x)**2 + (stack.y - card.y)**2
            if dist < cdist:
                closest = stack
                cdist = dist
        return closest

    def deal(self):
        self.reset()
        self.deck.shuffle()
        for i in range(NROWS):
            for r in self.rows[i:]:
                card = self.deck.deal()
                r.add(card)
        for r in self.rows:
            r.showtop()

    def reset(self):
        for stack in self.openstacks:
            while 1:
                card = stack.deal()
                if not card:
                    break
                self.deck.add(card)
                card.showback()


# Main function, run when invoked as a stand-alone Python program.

def main():
    root = Tk()
    game = Solitaire(root)
    root.protocol('WM_DELETE_WINDOW', root.quit)
    root.mainloop()

if __name__ == '__main__':
    main()
PK�
Q\����YYguido/brownian.pyonu�[����
��^c@s�ddlTddlZddlZddlZddlZdZdZdZdZdZ	dZ
dZdad	�Z
d
�Ze�dS(i����(t*Ni�i,i
itredicCs�t}tjtdt�}tjtdt�}|j||||||||dt�}xvts�tjdt	�}tjdt	�}tj
t�}y|j|||�Wnt
k
r�PnXtj|�qcWdS(Ng@tfilli(tRADIUStrandomtgausstWIDTHtSIGMAtHEIGHTtcreate_ovaltFILLtstoptBUZZtexpovariatetLAMBDAtmovetTclErrorttimetsleep(tcanvastrtxtytptdxtdytdt((s3/usr/lib64/python2.7/Demo/tkinter/guido/brownian.pytparticles.	
cCs�t�}t|dtdt�}|jdddd�d}tjdr`ttjd�}nx9t|�D]+}t	j
dtd	|f�}|j�qmWz|j
�WddaXdS(
NtwidththeightRtbothtexpandiittargettargs(tTktCanvasRRtpacktsystargvtinttranget	threadingtThreadRtstarttmainloopR(trootRtnptitt((s3/usr/lib64/python2.7/Demo/tkinter/guido/brownian.pytmain"s	
(tTkinterRR)RR%RRRRRRR
RRR1(((s3/usr/lib64/python2.7/Demo/tkinter/guido/brownian.pyt<module>s
		PK�
Q\�+�$RRguido/optionmenu.pyonu�[����
��^c@s�ddlTe�Ze�Zejd�eeeddd�Zej�dZ	e�Z
e
je	d
�eeee
fee	��Z
e
j�ej�dS(
i����(t*tOnetTwotThreetAahtBeetCeetDeetEffiN(RRRRR(tTkintertTktroott	StringVartvar1tsett
OptionMenutmenu1tpacktCHOICEStvar2tapplyttupletmenu2tmainloop(((s5/usr/lib64/python2.7/Demo/tkinter/guido/optionmenu.pyt<module>s
		

	
PK�
Q\^�����guido/wish.pyonu�[����
��^c@sddlZddlZejejdddd�Zejd�dZx�er\dZndZyee�Z	Wne
k
r�PnXee	d	Zejejd
de��rMeje	�yejde�Z
Wnejk
r�Zd
GeGHnXe
re
GHndZqMqMWdS(i����NtDISPLAYtwishtTkitupdatets% s
tinfotcompletetevals	TclError:(t_tkintertostcreatetenvironttktcalltcmdtpromptt	raw_inputtlinetEOFErrort
getbooleantrecordtresulttTclErrortmsg(((s//usr/lib64/python2.7/Demo/tkinter/guido/wish.pyt<module>s,
	


PK�
Q\27O�::guido/imageview.pyonu�[����
��^c@s*ddlTddlZd�Ze�dS(i����(t*NcCsOtjd}t�}td|�}t|d|�}|j�|j�dS(Nitfiletimage(tsystargvtTkt
PhotoImagetLabeltpacktmainloop(tfilenametroottimgtlabel((s4/usr/lib64/python2.7/Demo/tkinter/guido/imageview.pytmains
	
(tTkinterRR(((s4/usr/lib64/python2.7/Demo/tkinter/guido/imageview.pyt<module>s
	PK�
Q\	�7E� � guido/mbox.pycnu�[����
Afc@s)ddlZddlZddlZddlZddlZddlZddlTddlmZejddZ	d�Z
d�Zd�Zd	�Z
d
�Zejd�Zdd�Zdd
�Zd�Zdd�Zdadadd�Zd�Zd�Zd�Zddd�Ze
�dS(i����N(t*(tdialogtHOMEs/Mailc	Cs#daday#tjtjdd�\}}Wn(tjk
rY}|GHtjd�nXx1|D])}|d dkr�|daqa|aqaWtj�a	t	j
t�at�a
t
jatt
�atjidd6dd	6�tt�}|jid
d	6dd6�t|id
d6dd6�}|jid
d	6dd6�t|idd6�atjidd6dd	6dd6�tt
�atjdidd6td6�tjd�tjdidd6dd6�tjdt�|dftd<tdf|d<tjdtd�tjdt�tt�}|jidd6dd	6dd6�t|id
d6dd6�}|jid
d	6dd6�t|idd 6�atjidd6dd	6dd6�tt
�atjdid!d6td6�tjdid"d6td6�tjdid#d6t d6�tjd�tjdidd6dd6�tjdt!�|dftd<tdf|d<tjdt�tjdt"�tt
id$d%6�}|jid&d	6�tt
�a#t#jidd6dd	6�da%t
j&d'd�t'�t(�t
j)�dS((Ntinboxtallitit+texpandtbothtfilltytrighttsidetsunkentrelieftbditexportselectiontlefttcommandsOpen Foldertlabelt	separatortQuittexits<ButtonRelease-3>tsettyscrollcommandtyviews
<Double-1>s<3>tfixedtfontsOpen MessagesRemove MessagesRefile Messagetblacktbgtxi (*tfoldertseqtgetopttsystargvterrorRtmhlibtMHtmht
openfoldertmhftTktrootttktFramettoptpackt	ScrollbartListboxt	folderboxtMenut
foldermenutaddtopen_foldertbindt
folder_unposttfolder_posttscanboxtscanmenutopen_messagetremove_messagetrefile_messagetscan_unpostt	scan_posttbottNonetviewertminsizet
setfolderstrescantmainloop(	toptstargstmsgtargRt	folderbarRtscanbartrule2((s//usr/lib64/python2.7/Demo/tkinter/guido/mbox.pytmains�#


		"	

	
""	
	
	

	
cCs9|j|j}}tj|d|d�tj�dS(Ni
(tx_rootty_rootR4tposttgrab_set(teRR
((s//usr/lib64/python2.7/Demo/tkinter/guido/mbox.pyR9�scCs5tjdd�tj�tj�tjd�dS(Ntupdatet	idletaskstactive(R,tcallR4tgrab_releasetunposttinvoke(RT((s//usr/lib64/python2.7/Demo/tkinter/guido/mbox.pyR8�s

cCs9|j|j}}tj|d|d�tj�dS(Ni
(RPRQR;RRRS(RTRR
((s//usr/lib64/python2.7/Demo/tkinter/guido/mbox.pyR@�scCs5tjdd�tj�tj�tjd�dS(NRURVRW(R,RXR;RYRZR[(RT((s//usr/lib64/python2.7/Demo/tkinter/guido/mbox.pyR?�s

s^ *([0-9]+)cCs�tj�}t|�dkr\t|�dkr9d}nd}ttd|ddd�dS|d}tj|�atjt�a	t
�dS(Nis Please open one folder at a timesPlease select a folder to opensCan't Open FolderRitOK(R2tcurselectiontlenRR+tgetRR'R(R)RF(RTtselRJti((s//usr/lib64/python2.7/Demo/tkinter/guido/mbox.pyR6�s	
c	Cs9tj�}t|�dkr\t|�dkr9d}nd}ttd|ddd�dStd}d	td<tjd
d�|d}tj|�}tj	|�dkr+t
jtjd��}t
j|�}tr�tj�ndd
lm}|tdt|f|�atj�tj�n|td<dS(Nis!Please open one message at a timesPlease select a message to opensCan't Open MessageRiR\tcursortwatchRURVi����(t
MimeViewers+%s/%d(R:R]R^RR+R,RXR_t
scanparsertmatchtstringtatoitgroupR)topenmessageRCtdestroyRdRARR/tshow(	RTR`RJRbRatlinetnumtmRd((s//usr/lib64/python2.7/Demo/tkinter/guido/mbox.pyR<�s,	





cCs
|dkS(Ntreceived((theader((s//usr/lib64/python2.7/Demo/tkinter/guido/mbox.pytinterestingheader�scCs�tjd�}tj�}|s>ttddddd�dSg}xT|D]L}tj|�}tj|�dkrK|jt	j
tjd���qKqKWtj
|�t�tt|�|�dS(NisNo Message To Removes!Please select a message to removeRR\i(R:tnearestR]RR+R_ReRftappendRgRhRiR)tremovemessagesRFtfixfocustmin(RTtitopR`ttodoRaRm((s//usr/lib64/python2.7/Demo/tkinter/guido/mbox.pyR=�s	
&
Rc	Cs]tjd�}tj�}|s>ttddddd�dStj�}t|�dkr�|skd}nd}ttd	|ddd�dStj|d�}g}xT|D]L}tj|�}tj	|�dkr�|j
tjtj
d���q�q�Wt|kstr/|adatjt�antj|t�t�tt|�|�dS(
NisNo Message To Refiles!Please select a message to refileRR\is#Please select a folder to refile tos-Please select exactly one folder to refile tosNo Folder To Refile(R:RsR]RR+R2R^R_ReRfRtRgRhRit
lastrefilettofolderRBR'R(R)trefilemessagesRFRvRw(	RTRxR`t	folderselRJtrefiletoRyRaRm((s//usr/lib64/python2.7/Demo/tkinter/guido/mbox.pyR>�s4		
&cCs�tj�}xot|�D][}tjt|��}tj|�dkrtjtj	d��}||krtPqtqqWd}tj
|�tj|�dS(Niitend(R:tsizetrangeR_treprReRfRgRhRitselect_fromR(tnearRxtnRaRmRn((s//usr/lib64/python2.7/Demo/tkinter/guido/mbox.pyRv�s
cCs;tjdd�x$tj�D]}tjd|�qWdS(NiR(R2tdeleteR'tlistallfolderstinsert(tfn((s//usr/lib64/python2.7/Demo/tkinter/guido/mbox.pyRE
scCsWtrtj�dantjdd�x'ttt�D]}tjd|�q9WdS(NiR(	RCRkRBR:R�t
scanfolderRR R�(Rm((s//usr/lib64/python2.7/Demo/tkinter/guido/mbox.pyRFs
	RRcCs,td�tjd||fd�j��S(NcSs|d S(Ni����((Rm((s//usr/lib64/python2.7/Demo/tkinter/guido/mbox.pyt<lambda>Rsscan +%s %str(tmaptostpopent	readlines(Rtsequence((s//usr/lib64/python2.7/Demo/tkinter/guido/mbox.pyR�s(R�R"treR!RgR%tTkinterRtenvirontmailboxROR9R8R@R?tcompileReRBR6R<RrR=RzR{R>RvRERFR�(((s//usr/lib64/python2.7/Demo/tkinter/guido/mbox.pyt<module>s4
	x						
			PK�
Q\k>'��guido/hello.pyonu�[����
��^c@s3ddlZddlTd�Zd�Ze�dS(i����N(t*cCsAt�}t|�}d|d<t|d<|j�|j�dS(NsHello, worldttexttcommand(tTktButtont
quit_callbacktpacktmainloop(troottbutton((s0/usr/lib64/python2.7/Demo/tkinter/guido/hello.pytmains	


cCstjd�dS(Ni(tsystexit(((s0/usr/lib64/python2.7/Demo/tkinter/guido/hello.pyRs(RtTkinterR
R(((s0/usr/lib64/python2.7/Demo/tkinter/guido/hello.pyt<module>s
		PK�
Q\�X�\guido/ManPage.pycnu�[����
��^c@s�ddlZddlTddlmZddlmZdZdZejd�Zejd�Zejd	�Z	d
efd��YZ
de
fd
��YZeZd�Z
edkr�e
�ndS(i����N(t*(t_tkinter(tScrolledTexts*-Courier-Bold-R-Normal-*-120-*s!*-Courier-Medium-O-Normal-*-120-*s:^     Page [1-9][0-9]*[ 	]+\|^.*Last change:.*[1-9][0-9]*
s^[ 	]*
s^[ 	]*[Xv!_][Xv!_ 	]*
tEditableManPagecBsneZdd�Zd�Zd�Zd�ZeZd�Zd�Z	d�Z
d�Zd�Zd	d
�Z
RS(cKshttj||f|�|jddd�|jddt�|jddt�d|_d|_dS(NtXt	underlineit!tfontt_i(	tapplyRt__init__t
tag_configtBOLDFONTt
ITALICFONTtNonetfptlineno(tselftmastertcnf((s2/usr/lib64/python2.7/Demo/tkinter/guido/ManPage.pyR
s	cCs
|jdkS(N(RR(R((s2/usr/lib64/python2.7/Demo/tkinter/guido/ManPage.pytbusy%scCs|j�r|j�ndS(N(Rt
_endparser(R((s2/usr/lib64/python2.7/Demo/tkinter/guido/ManPage.pytkill)scCs-|j|�|jj|tj|j�dS(N(t_startparserttktcreatefilehandlerRtREADABLEt_filehandler(RR((s2/usr/lib64/python2.7/Demo/tkinter/guido/ManPage.pytasyncparsefile.s
cCs4|jj�}|s#|j�dS|j|�dS(N(RtreadlineRt
_parseline(RRtmasktnextline((s2/usr/lib64/python2.7/Demo/tkinter/guido/ManPage.pyR6s

cCszddlm}|d|d�}|j|d�}|j|�x'|j�}|s[Pn|j|�qEW|j�dS(Ni����(tselectgcSs||ggg|�dS(Ni((RttoutR!((s2/usr/lib64/python2.7/Demo/tkinter/guido/ManPage.pytavail@stheight(R!tgetintRRRR(RRR!R#R$R ((s2/usr/lib64/python2.7/Demo/tkinter/guido/ManPage.pyt
syncparsefile>s
cCs�|j�rtd�n|j�||_d|_d|_d|_d|_|d}t	|d<|j
dt�||d<dS(Nsstartparser: still busyitstates1.0(RtRuntimeErrortfilenoRRtoktemptyRtbuffertNORMALtdeletetEND(RRt	savestate((s2/usr/lib64/python2.7/Demo/tkinter/guido/ManPage.pyRLs
					

cCs�|j�std�n|jr1|jd�ny|jj|j�Wntk
r]}nX|jj�d|_|`
|`|`dS(Nsendparser: not busyt(RR(R,RRtdeletefilehandlerRtTclErrortcloseRR*R+(Rtmsg((s2/usr/lib64/python2.7/Demo/tkinter/guido/ManPage.pyR[s	
	cCs|js||_dStj|j�dkrDd|_||_dS|j}tj|�dkrt|}d|_nd}||_|js�d|_d|_dStj|�dkr�d|_d|_dS|d}t|d<t	dkr|j
dd�n|j
dt�|jrB|jd�|j
d|_
d|_n|sX|j|�n�d}d}xrttt|�t|���D]O}|||kr�||kr�|j|||!|�|}n||}q�q�W|j||�|j
d|_
||d<dS(	NiiR'g@tinsertsend-1cs
R1(R,t	emptyprogtmatchR+tulprogRR*t
footerprogR-t	TkVersiontmark_setR/t_insert_propRtrangetmintlen(RR ttextlinetproplineR0tptjti((s2/usr/lib64/python2.7/Demo/tkinter/guido/ManPage.pyRisV											

	
(	t cCs�|jt��}|jt�|�tdkrj|j|�}x'|D]}|j||t��qGWn|dkr�|j||t��ndS(Ng@RF(tindextAtInsertR6R;t	tag_namest
tag_removettag_add(Rtstrtproptherettagsttag((s2/usr/lib64/python2.7/Demo/tkinter/guido/ManPage.pyR=�s
N(t__name__t
__module__RR
RRRt	parsefileRR&RRRR=(((s2/usr/lib64/python2.7/Demo/tkinter/guido/ManPage.pyRs								<tReadonlyManPagecBseZdd�ZRS(cKs't|d<ttj||f|�dS(NR'(tDISABLEDR	RR
(RRR((s2/usr/lib64/python2.7/Demo/tkinter/guido/ManPage.pyR
�s
N(RQRRRR
(((s2/usr/lib64/python2.7/Demo/tkinter/guido/ManPage.pyRT�sc	CsNddl}ddl}d}d}d}|jdr]|jddkr]d}|jd=n|jdrz|jd}n|}|s�|dd!dkr�|d	}n|jj||�}nt�}|jdd�t|d
tdd�}|j	d
ddt
�|rt|d�}n|jd|d�}|j
|�|j�dS(Ni����s/usr/local/man/manntTcliis-fi����t.s.ntrelieftborderwidthitexpandtfilltrsnroff -man %s | ul -i(tostsystargvtpathtjointTktminsizetManPagetSUNKENtpacktBOTHtopentpopenRStmainloop(	R]R^tMANDIRtDEFAULTPAGEt	formattedtnametroottmanpageR((s2/usr/lib64/python2.7/Demo/tkinter/guido/ManPage.pyttest�s0 


	
t__main__(tretTkinterRRRR
tcompileR:R7R9RRTRdRqRQ(((s2/usr/lib64/python2.7/Demo/tkinter/guido/ManPage.pyt<module>s
	�	PK�
Q\"��@@guido/kill.pyonu�[����
Afc@s�ddlTddlmZddlmZddlZddlZdefd��YZdefd��YZ	e
d	kr�e	dd
d�Zej
�jd�ej
�jd
d
�ej�ndS(i����(t*(tsplitfields(tsplitNt	BarButtoncBseZdd�ZRS(cKsOttj||f|�|jdt�t|dd�|_|j|d<dS(Ntsidetnametmenu(tapplyt
Menubuttont__init__tpacktLEFTtMenuR(tselftmastertcnf((s//usr/lib64/python2.7/Demo/tkinter/guido/kill.pyR	sN(t__name__t
__module__tNoneR	(((s//usr/lib64/python2.7/Demo/tkinter/guido/kill.pyR
stKillc
Bs_eZdddddddd gZd�Zd�Zd�Zd�Zd�Zd!d�Z	RS("tDefaulttitLongs-litUsers-uitJobss-jtSignals-stMemorys-mtVMs-vtHexs-XcCsI|j|jj�d}t|�|}tjd|�|j�dS(Niskill -9 (tformat_listtformattgetRtostsystemt	do_update(R
tselectedtctpid((s//usr/lib64/python2.7/Demo/tkinter/guido/kill.pytkillscCs�|j|jj�\}}}tjd|�}t|d�}|jj|d�|d=|jj	j�d}|jj
jdt��x$|D]}|jj
j
d|�q�W|jj
jt|��dS(Nsps -w s
i(RRRtcommandst	getoutputRtheadertsettframetvscrolltlisttdeletetAtEndtinserttyviewtint(R
RtoptiontcolumntsR-tytline((s//usr/lib64/python2.7/Demo/tkinter/guido/kill.pyR" s
cCs6|jjdt�|jj|jj|j��dS(Ni(twidgettselect_cleartENDt
select_settnearestR6(R
te((s//usr/lib64/python2.7/Demo/tkinter/guido/kill.pyt	do_motion+scCs|jjdt�dS(Ni(R8R9R:(R
R=((s//usr/lib64/python2.7/Demo/tkinter/guido/kill.pytdo_leave.scCs,|j|jj|jj|j���dS(N(R&R8RR<R6(R
R=((s//usr/lib64/python2.7/Demo/tkinter/guido/kill.pytdo_10sc
Ks
tj|||�|jdddt�t|dddtdd�|_|jjdt�t|jd	d
�|j_|jjj	j
ddd
|j�t|jd	d�|j_t
|�|_|jjd�xYtt|j��D]B}|jjj	jd|j|dd
|jd|jd|�q�W|jj|jj|jj�t|dtdd�|_|jjdddt�t|�|_t|jdtdtddd|j�|j_|jjjdt�t|jdt�|j_t |jdt!ddddd|jjj�|j_"|jj"j#|jjd
<|jjjdt$dt%�|jj"jdddt�t&|d	dd
|j�|_'|j'jdddt�|jj"j(d|j)�|jj"j(d|j*�|jj"j(d|j+�|j�dS(NtexpanditfillRtbartrelieftborderwidthittexttFiletlabeltQuittcommandtViewitvariabletvaluetanchorttextvariabletorienttselectbackgrounds#eed5b7tselectborderwidthtyscrollRtUpdates<Motion>s<Leave>s<1>(,tFrameR	R
tBOTHtRAISEDRCtXRtfileRtadd_commandtquittviewtIntVarRR*trangetlenRtadd_radiobuttonR"t
tk_menuBarR+t	StringVarR)tLabeltFLATtNWRHt	ScrollbartVERTICALR,tListboxtSUNKENR-R1tRIGHTtYtButtontupdatetbindR>R?R@(R
RRtnum((s//usr/lib64/python2.7/Demo/tkinter/guido/kill.pyR	2sP		(RRi(Rs-li(Rs-ui(Rs-ji(Rs-si(Rs-mi(Rs-vi(Rs-XiN(
RRRR&R"R>R?R@RR	(((s//usr/lib64/python2.7/Demo/tkinter/guido/kill.pyRs						t__main__REisTkinter Process Killeri(tTkintertstringRRR'R RRRURRRR&twinfo_toplevelttitletminsizetmainloop(((s//usr/lib64/python2.7/Demo/tkinter/guido/kill.pyt<module>s
MPK�
Q\��kK�\�\guido/sortvisu.pyonu�[����
Afc@s�dZddlTddlmZmZddlZdZdZdZddd��YZ	d	dd
��YZ
d�Zd�Zd
�Z
d�Zd�Zd�Zd�Zd�Zd�Zd�Zddd��YZd�Zedkr�e�ndS(sjSorting algorithms visualizer using Tkinter.

This module is comprised of three ``components'':

- an array visualizer with methods that implement basic sorting
operations (compare, swap) as well as methods for ``annotating'' the
sorting algorithm (e.g. to show the pivot element);

- a number of sorting algorithms (currently quicksort, insertion sort,
selection sort and bubble sort, as well as a randomization function),
all using the array visualizer for its basic operations and with calls
to its annotation methods;

- and a ``driver'' class which can be used as a Grail applet or as a
stand-alone application.

i����(t*(tLinet	RectangleNi
itArraycBs�eZdd�Zd�ZdZd�Zd�ZdZdZ	d�Z
d�ZdZd	�Z
d
�Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�ZRS(cCs||_t|j�|_|jjdt�t|j�|_|jj�t|j�|_|jj�t|j�|_	|j	j�t
|jdddd�|_t
|jdddd�|_t
|jdddd�|_
g|_d|_|_|r|j|�ndS(Ntfilli(tmastertFrametframetpacktXtLabeltlabeltCanvastcanvastreportRtlefttrighttpivottitemstsizetmaxvaluetsetdata(tselfRtdata((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyt__init__"s 	


	cCs�|j}g|_x|D]}|j�qWt|�|_t|�|_|jjd|jdtd|jdt	�x7t
|j�D]&}|jjt||||��q�W|j
d|j�dS(NtwidthitheightsSort demo, size %d(RtdeletetlenRtmaxRR
tconfigtXGRIDtYGRIDtrangetappendt	ArrayItemtreset(RRtolditemstitemti((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyR4s		
$tnormalcCs
||_dS(N(tspeed(RR)((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pytsetspeedCscCs|jj�dS(N(Rtdestroy(R((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyR+FsicCs&d|_|jr"|jj�ndS(Ni(t
stop_mainlooptin_mainloopRtquit(R((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pytcancelLs		cCs|jr|jj�ndS(N(R-RR.(R((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pytstepQs	sArray.CancelledcCs�|jdkrd}n4|jdkr4|d}n|jdkrLd}n|js�|jj�|jj||jj�}d|_|jj�|jj|�d|_n|jr�d|_|j	d�t
j�ndS(	Ntfastestitfasti
ssingle-stepiʚ;it	Cancelled(R)R,RtupdatetafterR.R-tmainlooptafter_canceltmessageRR3(Rtmsecstid((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pytwaitWs"	
		
	
		
cCs|jS(N(R(R((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pytgetsizejscCszxit|j�D]X}|j|}||ko:|knrU|jjdd�q|jjdd�qW|j�dS(NRtredtorange(R!RRR&Rthide_left_right_pivot(RtfirsttlastR'R&((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pytshow_partitionms
cCsHx7t|j�D]&}|j|}|jjdd�qW|j�dS(NRR=(R!RRR&RR?(RR'R&((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pythide_partitionvs
cCs�d|ko|jkns-|j�dS|j|j�\}}}}|jj|ddf|ddfg�|jj�dS(Niii'(Rt	hide_leftRtpositionRtcoordsRR4(RRtx1ty1tx2ty2((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyt	show_left|s
*cCs�d|ko|jkns-|j�dS|j|j�\}}}}|jj|ddf|ddff�|jj�dS(Niii'(Rt
hide_rightRRERRFRR4(RRRGRHRIRJ((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyt
show_right�s
*cCs"|j�|j�|j�dS(N(RDRLt
hide_pivot(R((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyR?�s

cCs|jjddf�dS(Ni(ii(ii(RRF(R((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyRD�scCs|jjddf�dS(Ni(ii(ii(RRF(R((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyRL�scCsM|j|j�\}}}}|jjd|dfd|dff�dS(Niii'(RRERRF(RRRGRHRIRJ((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyt
show_pivot�scCs|jjddf�dS(Ni(ii(ii(RRF(R((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyRN�scCs`||krdS|j�|j|}|j|}|||j|<|j|<|j|�dS(N(t	countswapRtswapwith(RR'tjR&tother((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pytswap�s


cCs1|j�|j|}|j|}|j|�S(N(tcountcompareRt	compareto(RR'RRR&RS((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pytcompare�s


cCs7d|_d|_|j|�|j�|j�dS(Ni(t	ncomparestnswapsR8tupdatereportRC(Rtmsg((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyR$�s
		

cCs|jjd|�dS(Nttext(RR(RR[((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyR8�scCs|jd|_|j�dS(Ni(RYRZ(R((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyRP�scCs|jd|_|j�dS(Ni(RXRZ(R((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyRU�scCs-d|j|jf}|jjd|�dS(Ns%d cmps, %d swapsR\(RXRYRR(RR\((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyRZ�sN(t__name__t
__module__tNoneRRR)R*R+R-R,R/R0R3R;R<RBRCRKRMR?RDRLRORNRTRWR$R8RPRURZ(((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyR s8	
																							R#cBsbeZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�ZRS(
cCs�||_||_||_|j�\}}}}t|j||||dddddd�|_|jjd|j�|jjd|j	�|jjd	|j
�dS(
NRR=toutlinetblackRis
<Button-1>s<Button1-Motion>s<ButtonRelease-1>(tarraytindextvalueRERR
R&tbindt
mouse_downt
mouse_movetmouse_up(RRbRcRdRGRHRIRJ((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyR�s			cCs)|j}d|_d|_|j�dS(N(R&R_RbR(RR&((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyR�s			cCsA|j|_|j|_|j|_|j|_|jj�dS(N(txtlastxtytlastytorigxtorigyR&ttkraise(Rtevent((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyRf�s
cCsC|jj|j|j|j|j�|j|_|j|_dS(N(R&tmoveRiRjRkRl(RRp((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyRg�s'c	Cs�|j|j�}||jj�kr=|jj�d}n|dkrRd}n|jj|}|j}|||jj|<|jj|<||_|j�\}}}}|jj||f||ff�|j	|�dS(Nii(
tnearestindexRiRbR<RRcRER&RFtsetindex(	RRpR'RSthereRGRHRIRJ((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyRh�s		!	"cCs�t|j|�}|sdS|jjdkr7d}n|j�}||_|j�}t|||�}|jj�x<|D]4}|jj|d |df�|jj	d�q~WdS(NR1iii2(
tstepsRcRbR)REtinterpolateR&RoRFR;(RRctnstepstoldptstnewptst
trajectorytpts((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyRs�s		

cCs�t|j|j�}|sdS|jjdkr:d}n|j�}|j�}|j|j|_|_|j�}|j�}|jd}|jd}|jjdd�|jjdd�|jjj�|jjdkrk|jj	|d |df�|jj	|d |df�|jjj�|jjd|�|jjd|�|jj
d�dSt|||�}	t|||�}
|j|jkr�|jj
�|jj
�n|jj
�|jj
�z�xztt|	��D]f}|	|}|
|}
|jj	|d |df�|jj	|
d |
df�|jj
d�q�WWd|	d	}|
d	}
|jj	|d |df�|jj	|
d |
df�|jjd|�|jjd|�XdS(
NR1iRtgreentyellowssingle-stepii2i����(RuRcRbR)RER&RRR4RFR;RvRdRoR!R(RRSRwtmyoldptstotheroldptstmynewptstothernewptstmyfillt	otherfilltmytrajectorytothertrajectoryR'tmyptstotherpts((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyRQ�sV	








cCs�|jd}|jd}t|j|j�}|dkrJd}d}n%|dkred}d}n
d}}z:|jjd|�|jjd|�|jjd�Wd|jjd|�|jjd|�X|S(NRitwhiteRatgreyi�(R&tcmpRdRRbR;(RRSR�R�toutcometmyflasht
otherflash((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyRV-s"

		
cCsX|jdttd}|t}|jjdt}||jt}||||fS(Nii(RcRtWIDTHRbRR Rd(RRGRIRJRH((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyREBs

cCsttt|�t��dS(Ni(tinttroundtfloatR(RRi((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyRrIs(R]R^RRRfRgRhRsRQRVRERr(((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyR#�s							.		cCs[t||�}|dkr)|d}n.|dkrB|d}n|dkrWd}n|S(Niiii
(tabs(RttthereRw((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyRuOs

	cCs�t|�t|�kr$td�ndgt|�}t|�g}xmtd|�D]\}x@tt|��D],}||||||||||<qoW|jt|��qVW|jt|��|S(Ns,can't interpolate arrays of different lengthii(Rt
ValueErrorttupleR!R"(RxRytnR{tresR'tk((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyRvYs*cCs=|j�}|j|ddg|�|jd|�dS(NiisUniform data, size %d(R<RR$(RbR((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pytuniformhscCs;|j�}|jtd|d��|jd|�dS(NisDistinct data, size %d(R<RR!R$(RbR((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pytdistinctmscCsg|jd�|j�}x:t|�D],}tjd|d�}|j||�q&W|jd�dS(NtRandomizingiit
Randomized(R$R<R!trandomtrandintRTR8(RbR�R'RR((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyt	randomizers
cCs�|j�}|jd�xrtd|�D]a}|d}xN|dkr�|j||d�dkrhPn|j||d�|d}q<Wq)W|jd�dS(NsInsertion sortiitSorted(R<R$R!RWRTR8(RbRR'RR((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyt
insertionsortzs

cCs�|j�}|jd�z�xmt|�D]_}|j||�xFt|d|�D]1}|j||�dkrS|j||�qSqSWq)W|jd�Wd|j�XdS(NsSelection sortiiR�(R<R$R!RBRWRTR8RC(RbRR'RR((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyt
selectionsort�s
cCs�|j�}|jd�xat|�D]S}xJtd|�D]9}|j|d|�dkr<|j|d|�q<q<Wq&W|jd�dS(NsBubble sortiiR�(R<R$R!RWRTR8(RbRR'RR((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyt
bubblesort�s
c
Cs�|j�}|jd�zYd|fg}x6|rc|d\}}|d=|j||�||dkr�|jd�xvt|d|�D]a}|d}xN||kr�|j||d�dkr�Pn|j||d�|d}q�Wq�Wq.n|jd�|||d|d}}}|j||�dkrO|j||�n|j||�dkrz|j||�n|j||�dkr�|j||�n|}|j|�|jd	�|jd
�|}	|}
x
|jd�|
d}
|j	|
�x?|
|krF|j|
|�dkrF|
d}
|j	|
�qW|jd�|	d}	|j
|	�x?|	|kr�|j|	|�dkr�|	d}	|j
|	�qnW|	|
kr�|jd
�Pn|jd�|j|	|
�q�W|jd�|j||
�|
|}||	}|dkr>|j||
f�n|dkr.|j|	|f�q.q.W|jd�Wd|j�XdS(Nt	Quicksortii����isInsertion sortisChoosing pivotisPivot at left of partitioni�sSweep right pointersSweep left pointersEnd of partitions
Swap itemssSwap pivot backR�(
R<R$RBR8R!RWRTROR;RMRKR"RC(
RbRtstackR@RAR'RRR�RRRtn1tn2((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyt	quicksort�sx
	


 





'



'





cCs<x5x.ttttgD]}t|�||�qWqWdS(N(R�R�R�R�R�(Rbtalg((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pytdemosort�s
tSortDemocBs�eZdd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
d
�Zd�ZRS(icCs||_||_d|_t|j�|_t|�|_|jjdt�t|j�|_	|j	jdt
dt�t|j�|_|jjdt
dt�t|j	ddd|j�|_|jjdt�t|j	ddd|j�|_|jjdt�t|j	ddd|j�|_|jjdt�t|j	dd	d|j�|_|jjdt�d
tfd��Y}||j|�|_|jj|�dd
ddgtddd�}|j|kr�|j|j�|j�ntt|j	|jft |��|_!|j!jdt�t"|j�|_#|j#jd�t|j	|j#dddd�|_$|j$jdt�t|j	ddd|j%�|_&|j&jdt�t|jddd|j'�|_(|j(jdt�t|jddd|j)�|_*|j*jdt�t|jddd|j+�|_,|j,jdt�t|jddd|j-�|_.|j.jdt�t|jddd|j/�|_0|j0jdt�|j0j1dt2�t|jddd|j3�|_4|j4jdt�dS(NitsideRR\R�tcommandsInsertion sortsSelection sortsBubble sorttMyIntVarcBseZd�Zd�ZRS(cSs||_tj||�dS(N(tdemotIntVarR(RRR�((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyRs	cSs9tj||�t|�dkr5|jj|�ndS(Nt0(R�tsettstrR�tresize(RRd((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyR�s(R]R^RR�(((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyR��s	iiiiii7R(ssingle-stepR2R1tStept	RandomizetUniformtDistincttDemotCanceltstatetQuit(5RRtbusyRRbRtbotframeRtBOTTOMtbotleftframetLEFTtYt
botrightframetRIGHTtButtontc_qsorttb_qsortR	tc_isorttb_isorttc_ssorttb_ssorttc_bsorttb_bsortR�tv_sizeR�R!R"tsorttapplyt
OptionMenuR�tm_sizet	StringVartv_speedtm_speedtc_steptb_steptc_randomizetb_randomizet	c_uniformt	b_uniformt
c_distinctt
b_distincttc_demotb_demotc_canceltb_cancelRtDISABLEDtc_quittb_quit(RRRR�tsizes((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyR�sv				"
"cCsG|jr|jj�dS||_|jjtd|jd��dS(Ni(R�RtbellRRbRR!(Rtnewsize((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyR�0s
	
	cCs|jt�dS(N(trunR�(R((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyR�7scCs|jt�dS(N(R�R�(R((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyR�:scCs|jt�dS(N(R�R�(R((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyR�=scCs|jt�dS(N(R�R�(R((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyR�@scCs|jt�dS(N(R�R�(R((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyR�CscCs|jt�dS(N(R�R�(R((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyR�FscCs|jt�dS(N(R�R�(R((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyR�IscCs|jt�dS(N(R�R�(R((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyR�LscCs�|jr|jj�dSd|_|jj|jj��|jjdt	�y||j�Wnt
jk
rvnX|jjdt�d|_dS(NiR�i(
R�RR�RbR*R�tgetR�RtNORMALRR3R�(Rtfunc((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyR�Os	
	cCs+|js|jj�dS|jj�dS(N(R�RR�RbR/(R((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyR�]s	
cCsK|js|jj�dS|jjd�|jjd�|jj�dS(Nssingle-step(R�RR�R�R�RbR*R0(R((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyR�cs	
cCs3|jr|jj�n|jj|jj�dS(N(R�RbR/Rt
after_idleR.(R((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyR�ks	(R]R^RR�R�R�R�R�R�R�R�R�R�R�R�R�(((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyR��sL												cCs6t�}t|�}|jd|j�|j�dS(NtWM_DELETE_WINDOW(tTkR�tprotocolR�R6(trootR�((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pytmainss	t__main__((((t__doc__tTkinterRRRR�RR R�RR#RuRvR�R�R�R�R�R�R�R�R�R�R](((s3/usr/lib64/python2.7/Demo/tkinter/guido/sortvisu.pyt<module>s,
��	
						
			=		�	PK�
Q\���ooguido/dialog.pycnu�[����
Afc@sKddlTddlZd�Zd�Zd�ZedkrGe�ndS(i����(t*NcGs�t|dd�}|j|�|jd�t|dtdd�}|jdtdt�t|dtdd�}|jdtdt�t	|dd	d
|dd�}	|	jdt
d
ddtdddd�|rt|d|�}
|
jdtdddd�nt
�}g}d}
x�|D]�}t|d
|d||
d��}|j|�|
|kr�t|dtdd�}|jdtd
ddddd�|j�|jd|dtdddddddd�n.|jdtd
ddddddddd�|
d}
q!W|dkrA|jd||||d��n|j�}|j�|j�|j|�|j�|r�|j�n|j�S(Ntclass_tDialogtrelieftborderwidthitsidetfilltwidtht3ittexttfonts$-Adobe-Times-Medium-R-Normal-*-180-*texpandtpadxt3mtpadytbitmapitcommandcSs
|j|�S(N(tset(tvti((s1/usr/lib64/python2.7/Demo/tkinter/guido/dialog.pyt<lambda>(tt2mtin_tipadxtipadyt1ms<Return>cSs|j�|j|�fS(N(tflashR(tetbRR((s1/usr/lib64/python2.7/Demo/tkinter/guido/dialog.pyR:s	(tToplevelttitleticonnametFrametRAISEDtpacktTOPtBOTHtBOTTOMtMessagetRIGHTtLabeltLEFTtIntVartButtontappendtSUNKENtlifttbindt	focus_gettgrab_sett	focus_settwaitvartdestroytget(tmasterRR	RtdefaulttargstwttoptbottmsgtbmtvartbuttonsRtbutRtbdtoldFocus((s1/usr/lib64/python2.7/Demo/tkinter/guido/dialog.pytdialogsN

	(	
!
"
	




c	CsRttddddd�}dG|GHttddd	d
ddd
�}dG|GHdS(NsNot Respondings=The file server isn't responding right now; I'll keep trying.Ri����tOKspressed buttons
File ModifiedswFile "tcl.h" has been modified since the last time it was saved. Do you want to save it before exiting the application?twarningis	Save FilesDiscard ChangessReturn To Editor(RDt
mainWidget(R((s1/usr/lib64/python2.7/Demo/tkinter/guido/dialog.pytgoLs 			cCs}ddl}t�atjt�ttdddt�}|j�ttddd|j�}|jdt	�tj
�dS(Ni����R	sPress Here To StartRtExitR(tsysR!RGtPacktconfigR,RHR#texitR%tmainloop(RJtstarttendit((s1/usr/lib64/python2.7/Demo/tkinter/guido/dialog.pyttestas	

t__main__(tTkinterRJRDRHRQt__name__(((s1/usr/lib64/python2.7/Demo/tkinter/guido/dialog.pyt<module>s
	A		PK�
Q\qf�XXguido/newmenubardemo.pyonu�[����
Afc@sFdZddlTddd��YZd�ZedkrBe�ndS(	s.Play with the new Tk 8.0 toplevel menu option.i����(t*tAppcBseZd�ZRS(cCsu||_t|j�|_t|j�|_|jjdd�|jjdd�|jjdd�|jj�|jjddd|jj�t|j�|_|jjdd�|jjdd�|jjdd	�t|jd
d�|_|jjdd�|jj	dd
d|j�|jj	ddd|j�|jj	ddd|j�t
d|j�|_dS(NtlabeltNewsOpen...tClosetQuittcommandtCuttCopytPastetnamethelpsAbout...tFiletmenutEdittHelp(tmastertMenutmenubartfilemenutadd_commandt
add_separatortquitteditmenuthelpmenutadd_cascadetToplevelttop(tselfR((s9/usr/lib64/python2.7/Demo/tkinter/guido/newmenubardemo.pyt__init__	s$	
(t__name__t
__module__R(((s9/usr/lib64/python2.7/Demo/tkinter/guido/newmenubardemo.pyRscCs-t�}|j�t|�}|j�dS(N(tTktwithdrawRtmainloop(troottapp((s9/usr/lib64/python2.7/Demo/tkinter/guido/newmenubardemo.pytmain(s	
t__main__N((t__doc__tTkinterRR%R(((s9/usr/lib64/python2.7/Demo/tkinter/guido/newmenubardemo.pyt<module>s

!	PK�
Q\.��,#,#guido/tkman.pynuȯ��#! /usr/bin/python2.7

# Tk man page browser -- currently only shows the Tcl/Tk man pages

import sys
import os
import string
import re
from Tkinter import *
from ManPage import ManPage

MANNDIRLIST = ['/depot/sundry/man/mann','/usr/local/man/mann']
MAN3DIRLIST = ['/depot/sundry/man/man3','/usr/local/man/man3']

foundmanndir = 0
for dir in MANNDIRLIST:
    if os.path.exists(dir):
        MANNDIR = dir
        foundmanndir = 1

foundman3dir = 0
for dir in MAN3DIRLIST:
    if os.path.exists(dir):
        MAN3DIR = dir
        foundman3dir =  1

if not foundmanndir or not foundman3dir:
    sys.stderr.write('\n')
    if not foundmanndir:
        msg = """\
Failed to find mann directory.
Please add the correct entry to the MANNDIRLIST
at the top of %s script.""" % \
sys.argv[0]
        sys.stderr.write("%s\n\n" % msg)
    if not foundman3dir:
        msg = """\
Failed to find man3 directory.
Please add the correct entry to the MAN3DIRLIST
at the top of %s script.""" % \
sys.argv[0]
        sys.stderr.write("%s\n\n" % msg)
    sys.exit(1)

del foundmanndir
del foundman3dir

def listmanpages(mandir):
    files = os.listdir(mandir)
    names = []
    for file in files:
        if file[-2:-1] == '.' and  (file[-1] in 'ln123456789'):
            names.append(file[:-2])
    names.sort()
    return names

class SelectionBox:

    def __init__(self, master=None):
        self.choices = []

        self.frame = Frame(master, name="frame")
        self.frame.pack(expand=1, fill=BOTH)
        self.master = self.frame.master
        self.subframe = Frame(self.frame, name="subframe")
        self.subframe.pack(expand=0, fill=BOTH)
        self.leftsubframe = Frame(self.subframe, name='leftsubframe')
        self.leftsubframe.pack(side=LEFT, expand=1, fill=BOTH)
        self.rightsubframe = Frame(self.subframe, name='rightsubframe')
        self.rightsubframe.pack(side=RIGHT, expand=1, fill=BOTH)
        self.chaptervar = StringVar(master)
        self.chapter = Menubutton(self.rightsubframe, name='chapter',
                                  text='Directory', relief=RAISED,
                                  borderwidth=2)
        self.chapter.pack(side=TOP)
        self.chaptermenu = Menu(self.chapter, name='chaptermenu')
        self.chaptermenu.add_radiobutton(label='C functions',
                                         value=MAN3DIR,
                                         variable=self.chaptervar,
                                         command=self.newchapter)
        self.chaptermenu.add_radiobutton(label='Tcl/Tk functions',
                                         value=MANNDIR,
                                         variable=self.chaptervar,
                                         command=self.newchapter)
        self.chapter['menu'] = self.chaptermenu
        self.listbox = Listbox(self.rightsubframe, name='listbox',
                               relief=SUNKEN, borderwidth=2,
                               width=20, height=5)
        self.listbox.pack(expand=1, fill=BOTH)
        self.l1 = Button(self.leftsubframe, name='l1',
                         text='Display manual page named:',
                         command=self.entry_cb)
        self.l1.pack(side=TOP)
        self.entry = Entry(self.leftsubframe, name='entry',
                            relief=SUNKEN, borderwidth=2,
                            width=20)
        self.entry.pack(expand=0, fill=X)
        self.l2frame = Frame(self.leftsubframe, name='l2frame')
        self.l2frame.pack(expand=0, fill=NONE)
        self.l2 = Button(self.l2frame, name='l2',
                         text='Search regexp:',
                         command=self.search_cb)
        self.l2.pack(side=LEFT)
        self.casevar = BooleanVar()
        self.casesense = Checkbutton(self.l2frame, name='casesense',
                                     text='Case sensitive',
                                     variable=self.casevar,
                                     relief=FLAT)
        self.casesense.pack(side=LEFT)
        self.search = Entry(self.leftsubframe, name='search',
                            relief=SUNKEN, borderwidth=2,
                            width=20)
        self.search.pack(expand=0, fill=X)
        self.title = Label(self.leftsubframe, name='title',
                           text='(none)')
        self.title.pack(side=BOTTOM)
        self.text = ManPage(self.frame, name='text',
                            relief=SUNKEN, borderwidth=2,
                            wrap=NONE, width=72,
                            selectbackground='pink')
        self.text.pack(expand=1, fill=BOTH)

        self.entry.bind('<Return>', self.entry_cb)
        self.search.bind('<Return>', self.search_cb)
        self.listbox.bind('<Double-1>', self.listbox_cb)

        self.entry.bind('<Tab>', self.entry_tab)
        self.search.bind('<Tab>', self.search_tab)
        self.text.bind('<Tab>', self.text_tab)

        self.entry.focus_set()

        self.chaptervar.set(MANNDIR)
        self.newchapter()

    def newchapter(self):
        mandir = self.chaptervar.get()
        self.choices = []
        self.addlist(listmanpages(mandir))

    def addchoice(self, choice):
        if choice not in self.choices:
            self.choices.append(choice)
            self.choices.sort()
        self.update()

    def addlist(self, list):
        self.choices[len(self.choices):] = list
        self.choices.sort()
        self.update()

    def entry_cb(self, *e):
        self.update()

    def listbox_cb(self, e):
        selection = self.listbox.curselection()
        if selection and len(selection) == 1:
            name = self.listbox.get(selection[0])
            self.show_page(name)

    def search_cb(self, *e):
        self.search_string(self.search.get())

    def entry_tab(self, e):
        self.search.focus_set()

    def search_tab(self, e):
        self.entry.focus_set()

    def text_tab(self, e):
        self.entry.focus_set()

    def updatelist(self):
        key = self.entry.get()
        ok = filter(lambda name, key=key, n=len(key): name[:n]==key,
                 self.choices)
        if not ok:
            self.frame.bell()
        self.listbox.delete(0, AtEnd())
        exactmatch = 0
        for item in ok:
            if item == key: exactmatch = 1
            self.listbox.insert(AtEnd(), item)
        if exactmatch:
            return key
        n = self.listbox.size()
        if n == 1:
            return self.listbox.get(0)
        # Else return None, meaning not a unique selection

    def update(self):
        name = self.updatelist()
        if name:
            self.show_page(name)
            self.entry.delete(0, AtEnd())
            self.updatelist()

    def show_page(self, name):
        file = '%s/%s.?' % (self.chaptervar.get(), name)
        fp = os.popen('nroff -man %s | ul -i' % file, 'r')
        self.text.kill()
        self.title['text'] = name
        self.text.parsefile(fp)

    def search_string(self, search):
        if not search:
            self.frame.bell()
            print 'Empty search string'
            return
        if not self.casevar.get():
            map = re.IGNORECASE
        else:
            map = None
        try:
            if map:
                prog = re.compile(search, map)
            else:
                prog = re.compile(search)
        except re.error, msg:
            self.frame.bell()
            print 'Regex error:', msg
            return
        here = self.text.index(AtInsert())
        lineno = string.atoi(here[:string.find(here, '.')])
        end = self.text.index(AtEnd())
        endlineno = string.atoi(end[:string.find(end, '.')])
        wraplineno = lineno
        found = 0
        while 1:
            lineno = lineno + 1
            if lineno > endlineno:
                if wraplineno <= 0:
                    break
                endlineno = wraplineno
                lineno = 0
                wraplineno = 0
            line = self.text.get('%d.0 linestart' % lineno,
                                 '%d.0 lineend' % lineno)
            i = prog.search(line)
            if i >= 0:
                found = 1
                n = max(1, len(prog.group(0)))
                try:
                    self.text.tag_remove('sel',
                                         AtSelFirst(),
                                         AtSelLast())
                except TclError:
                    pass
                self.text.tag_add('sel',
                                  '%d.%d' % (lineno, i),
                                  '%d.%d' % (lineno, i+n))
                self.text.mark_set(AtInsert(),
                                   '%d.%d' % (lineno, i))
                self.text.yview_pickplace(AtInsert())
                break
        if not found:
            self.frame.bell()

def main():
    root = Tk()
    sb = SelectionBox(root)
    if sys.argv[1:]:
        sb.show_page(sys.argv[1])
    root.minsize(1, 1)
    root.mainloop()

main()
PK�
Q\���,�)�)guido/canvasevents.pyonu�[����
Afc@s�ddlTddlmZmZmZdefd��YZddd��YZdefd��YZd	dd
��YZdefd��YZd
efd��YZ	de	fd��YZ
ddd��YZd�Ze
dkr�e�ndS(i����(t*(tOvaltGroupt
CanvasTextRcBseZddd�ZRS(cCs|jj|j||�S(N(tcanvasttag_bindtid(tselftsequencetcommand((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pytbindsN(t__name__t
__module__tNoneR
(((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pyR
stObjectcBsYeZdZddddd�Zd�Zd�Zd�Zd�Zd	�Zd
�Z	RS(s�Base class for composite graphical objects.

    Objects belong to a canvas, and can be moved around on the canvas.
    They also belong to at most one ``pile'' of objects, and can be
    transferred between piles (or removed from their pile).

    Objects have a canonical ``x, y'' position which is moved when the
    object is moved.  Where the object is relative to this position
    depends on the object; for simple objects, it may be their center.

    Objects have mouse sensitivity.  They can be clicked, dragged and
    double-clicked.  The behavior may actually be determined by the pile
    they are in.

    All instance attributes are public since the derived class may
    need them.

    itredtobjectcCsJ||_||_||_d|_t|j�|_|j||�dS(N(RtxtyR
tpileRtgrouptcreateitems(RRRRtfillttext((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pyt__init__#s				cCs
t|j�S(N(tstrR(R((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pyt__str__+sc
Cs�t|j|jd|jd|jd|jdd|dd�|_|jj|j�t|j|j|jd|�|_|jj|j�dS(Nii
RtwidthiR(	RRRRt
_Object__ovalRtaddtag_withtagRt
_Object__text(RRR((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pyR.s	+	cCsW||kodknr dS|jj||�|j||_|j||_dS(Ni(RtmoveRR(Rtdxtdy((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pytmoveby7s
cCs"|j||j||j�dS(N(R"RR(RRR((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pytmoveto>scCsN|jr%|jj|�d|_n||_|jrJ|jj|�ndS(N(RtdeleteR
tadd(RR((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pyttransferAs			cCs|jj�dS(N(Rttkraise(R((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pyR'Is(
RRt__doc__RRRR"R#R&R'(((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pyRs						tBottomcBseZdZd�ZRS(s+An object to serve as the bottom of a pile.c
Gs]t|j|jd|jd|jd|jddddd�|_|jj|j�dS(Nii
Rtgraytoutlinet(RRRRt
_Bottom__ovalRR(Rtargs((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pyRQs	+(RRR(R(((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pyR)MstPilecBsPeZdZdd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
RS(	sA group of graphical objects.cCs~||_||_||_g|_t|j|j|j�|_t|jd|�|_|jj|jj�|j	�dS(Nttag(
RRRtobjectsR)tbottomRRRtbindhandlers(RRRRR0((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pyR\s				cCs0|jjd|j�|jjd|j�dS(Ns<1>s
<Double-1>(RR
tclickhandlertdoubleclickhandler(R((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pyR3fscCs4|jj|�|jj|j�|j|�dS(N(R1tappendRRtposition(RR((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pyR%jscCs'|jj|j�|jj|�dS(N(RtdtagR1tremove(RR((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pyR$oscCsF|j�|jj|�}|j|j|d|j|d�dS(Nii(R'R1tindexR#RR(RRti((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pyR7ss
cCsdS(N((Rtevent((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pyR4xscCsdS(N((RR<((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pyR5{sN(RRR(R
RR3R%R$R7R4R5(((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pyR/Xs
					t
MovingPilecBsAeZd�ZdZd�ZeZd�Zd�Zd�Z	RS(cCs=tj|�|jjd|j�|jjd|j�dS(Ns<B1-Motion>s<ButtonRelease-1>(R/R3RR
t
motionhandlertreleasehandler(R((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pyR3�s
cCs�|jjd�}xMtt|j��D])}|j|}|jj|kr(Pq(q(Wd|_dS|j||_x|jD]}|j	�q|W|j
|_|j|_
dS(Ntcurrent(RtgettagstrangetlenR1RR0R
tmovethisR'RtlastxRtlasty(RR<ttagsR;to((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pyR4�s
	cCsm|js
dS|j|j}|j|j}|j|_|j|_x!|jD]}|j||�qOWdS(N(RDRRERRFR"(RR<R R!RH((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pyR>�s	cCs-|j}|sdSd|_|j|�dS(N(RDR
t
finishmove(RR<R1((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pyR?�s
		cCs"x|D]}|j|�qWdS(N(R7(RR1RH((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pyRI�s
N(
RRR3R
RDR4R5R>R?RI(((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pyR=s			
	tPile1cBs>eZdZdZdZd�Zd�Zd�Zd�ZRS(i2tp1cCs5||_tj||jj|j|j|j�dS(N(tdemoR=RRRRR0(RRL((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pyR�s	cCsMy|jd}Wntk
r%dSX|j|j��tj||�dS(Ni����(R1t
IndexErrorR&totherR=R5(RR<RH((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pyR5�s
cCs
|jjS(N(RLtp2(R((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pyRN�scCs�|d}|j�}|j|j}}||jd||jd||jd||jdkr�x.|D]}|j|�qpWntj||�dS(Nii(RNRRR&R=RI(RR1RHtpRR((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pyRI�s
@
(	RRRRR0RR5RNRI(((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pyRJ�s			tPile2cBs#eZdZdZdZd�ZRS(i�i2ROcCs
|jjS(N(RLRK(R((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pyRN�s(RRRRR0RN(((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pyRQ�stDemocBseZd�ZRS(cCs�||_t|dddddddtdd�|_|jjd	d
dt�t|�|_t|�|_	t
|jddd
d�}t
|jddd
d�}t
|jddd
d�}|j|j�|j|j�|j|j	�dS(NRi�theightt
backgroundtyellowtrelieftborderwidthitexpandiRRRto1tgreento2s
light blueto3(tmastertCanvastSUNKENRtpacktBOTHRJRKRQRORR&(RR]RYR[R\((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pyR�s		(RRR(((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pyRR�scCs6t�}t|�}|jd|j�|j�dS(NtWM_DELETE_WINDOW(tTkRRtprotocoltquittmainloop(trootRL((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pytmain�s	t__main__N((((tTkinterR^RRRRR)R/R=RJRQRRRhR(((s7/usr/lib64/python2.7/Demo/tkinter/guido/canvasevents.pyt<module>s
?'0
	PK�
Q\.��55guido/svkill.pyonu�[����
Afc@s�ddlTedkr"ed�nddlmZddlmZddlZddlZejdZ	de
fd	��YZd
efd��YZ
edkr�e
dd
d�Zej�jd�ej�jdd�ej�ndS(i����(t*g@s/This version of svkill requires Tk 4.0 or later(tsplitfields(tsplitNtLOGNAMEt	BarButtoncBseZdd�ZRS(cKsOttj||f|�|jdt�t|dd�|_|j|d<dS(Ntsidetnametmenu(tapplyt
Menubuttont__init__tpacktLEFTtMenuR(tselftmastertcnf((s1/usr/lib64/python2.7/Demo/tkinter/guido/svkill.pyR
sN(t__name__t
__module__tNoneR
(((s1/usr/lib64/python2.7/Demo/tkinter/guido/svkill.pyRstKillcBs|eZdddd ded	efgZd!d"d#d$d%d&gZd�Zd�Zd�Zd�Zd�Z	d'd�ZRS((tDefaultts
Every (-e)s-esNon process group leaders (-d)s-dsNon leaders with tty (-a)s-asFor this user (-u %s)s-u %sis	Long (-l)s-lis	Full (-f)s-fisFull Long (-f -l)s-l -fsSession and group ID (-j)s-jsScheduler properties (-c)s-ccCsI|j|jj�d}t|�|}tjd|�|j�dS(Niskill -9 (tformat_listtformattgetRtostsystemt	do_update(Rtselectedtctpid((s1/usr/lib64/python2.7/Demo/tkinter/guido/svkill.pytkill)scCs�|j|jj�d}|j|jj�d}tjd||f�}t|d�}|jj	|dd�|d=|j
jjdt
��x$|D]}|j
jjd|�q�WdS(Nisps %s %ss
is
          (RRRt	view_listtviewtcommandst	getoutputRtheadertsettframetlisttdeletetAtEndtinsert(RRR"tsR(tline((s1/usr/lib64/python2.7/Demo/tkinter/guido/svkill.pyR.s
cCs6|jjdd�|jj|jj|j��dS(Nt0tend(twidgettselect_cleart
select_settnearestty(Rte((s1/usr/lib64/python2.7/Demo/tkinter/guido/svkill.pyt	do_motion8scCs|jjdd�dS(NR.R/(R0R1(RR5((s1/usr/lib64/python2.7/Demo/tkinter/guido/svkill.pytdo_leave;scCs,|j|jj|jj|j���dS(N(R R0RR3R4(RR5((s1/usr/lib64/python2.7/Demo/tkinter/guido/svkill.pytdo_1=scKs�ttj||f|�|jdddt�t|dddtdd�|_|jjdt�t|jd	d
�|j_	|jj	j
jddd
|j�t|jd	d�|j_
t|jd	d�|j_t|�|_
|j
jd�t|�|_|jjd�xatt|j��D]J}|j|\}}|jj
j
jd|d
|jd|j
d|�q*Wxdtt|j��D]M}|j|\}}}|jjj
jd|d
|jd|jd|�q�W|jj|jj	|jj
|jj�t|dtdd�|_|jjdddt�t|�|_t|jdtdtddddd|j�|j_|jjjdtdt �t!|jdt"�|j_#t$|jdt%ddddddddddd t&d!|jj#j�|j_'|jj'j(|jj#d
<|jj#jd"t)dt�|jj'jdddt�t*|d	d#d
|j�|_+|j+jdt�|jj'j,d$|j-�|jj'j,d%|j.�|jj'j,d&|j/�|j�dS('NtexpanditfillRtbartrelieftborderwidthittexttFiletlabeltQuittcommandtViewtFormatitvariabletvaluetanchortfonts*-Courier-Bold-R-Normal-*-120-*ttextvariabletorients!*-Courier-Medium-R-Normal-*-120-*twidthi(theighti
tselectbackgrounds#eed5b7tselectborderwidtht
selectmodetyscrollRtUpdates<Motion>s<Leave>s<1>(0RtFrameR
RtBOTHtRAISEDR;tXRtfileRtadd_commandtquitR"RtIntVarR&trangetlenR!tadd_radiobuttonRRt
tk_menuBarR't	StringVarR%tLabeltFLATtNWR@tYtWt	ScrollbartVERTICALtvscrolltListboxtSUNKENtBROWSER(tyviewtRIGHTtButtontupdatetbindR6R7R8(RRRtnumR@toptiontcol((s1/usr/lib64/python2.7/Demo/tkinter/guido/svkill.pyR
?sv					
	(RR(s
Every (-e)s-e(sNon process group leaders (-d)s-d(sNon leaders with tty (-a)s-a(RRi(s	Long (-l)s-li(s	Full (-f)s-fi(sFull Long (-f -l)s-l -fi(sSession and group ID (-j)s-ji(sScheduler properties (-c)s-ciN(RRtuserR!RR RR6R7R8RR
(((s1/usr/lib64/python2.7/Demo/tkinter/guido/svkill.pyRs"			
			t__main__R=isTkinter Process Killer (SYSV)i(tTkintert	TkVersiontImportErrortstringRRR#RtenvironRrR	RRRRRRR twinfo_toplevelttitletminsizetmainloop(((s1/usr/lib64/python2.7/Demo/tkinter/guido/svkill.pyt<module>s

dPK�
Q\��V���
guido/rmt.pycnu�[����
Afc
@s�ddlTddlZe�ZejZeededd�Zejde	�ee�Z
e
jddde�ee
de
�Zejd	ede�ee
deddd
ejdd�Zejd	ededd�ejdd
d�ejed<ejd�ejd�eedddd�Zejd	e�ee�Zeed<eedd�Zejddddde�ejdddddej �d�Z!ej"de!�d�Z#ej"de#�d�Z$ej"d e$�d!�Z%ej"d"e%�d#�Z&ej"d$e&�d%�Z'ej"d&e'�ej"d'e'�ej"d(e'�d)�Z(d*�Z)d+�Z*d,�Z+e+ed-<ej,e�ej-�a.e)�ej/�ej0�dS(.i����(t*Ntrelieftborderwidthitfilltexpanditsidetyscrollcommandtsetgridtboldtfonts$-Adobe-Courier-Bold-R-Normal-*-120-*tcommandsTk Remote Controllers	Tk RemotettexttFilet	underlineitmenuttearofftlabelsSelect ApplicationtQuitcCs?|j}|j}tjdd�tjdt||��dS(Nstk_priv(selectMode)tchartanchor(txtytttsetvartmark_settAt(teRR((s./usr/lib64/python2.7/Demo/tkinter/guido/rmt.pytsingle15s		s<1>cCs<|j}|j}tjdd�tjt||��dS(Nstk_priv(selectMode)tword(RRRRttk_textSelectToR(RRR((s./usr/lib64/python2.7/Demo/tkinter/guido/rmt.pytdouble1=s		s
<Double-1>cCs<|j}|j}tjdd�tjt||��dS(Nstk_priv(selectMode)tline(RRRRRR(RRR((s./usr/lib64/python2.7/Demo/tkinter/guido/rmt.pyttriple1Ds		s
<Triple-1>cCstjt�d�t�dS(Ns
(RtinserttAtInserttinvoke(R((s./usr/lib64/python2.7/Demo/tkinter/guido/rmt.pyt	returnkeyKss<Return>cCsStjt�tj��tjt��tjt��ddkrOt�ndS(Ni����s.0(RR!R"t
selection_gettyview_pickplacetindexR#(R((s./usr/lib64/python2.7/Demo/tkinter/guido/rmt.pytcontrolvPss<Control-v>cCsHtjd�tjd�krDtjdt��tjt��ndS(Nt	promptEndsinsert - 1 char(RR'tdeleteR"R&(R((s./usr/lib64/python2.7/Demo/tkinter/guido/rmt.pyt	backspaceZss<BackSpace>s<Control-h>s<Delete>cCs�tjdt��}tjtjdd|��r�ttj�krZtjd|�}ntj	t|�}|r�tj
t�|d�nt�ntjt��dS(NspromptEnd + 1 chartinfotcompletetevals
(
RtgetR"t
getbooleanttktcalltapptroott
winfo_nametsendR!tpromptR&(tcmdtmsg((s./usr/lib64/python2.7/Demo/tkinter/guido/rmt.pyR#is
cCs>tjt�td�tjdd�tjddd�dS(Ns: R)sinsert - 1 charRsinsert linestart(RR!R"R3Rttag_add(((s./usr/lib64/python2.7/Demo/tkinter/guido/rmt.pyR7uscCsA|atjdd�tjd|d�tjddd�dS(NspromptEnd linestartR)t:R(R3RR*R!R:(tappName((s./usr/lib64/python2.7/Demo/tkinter/guido/rmt.pytnewApp~scCs�tjd�tjdd�tj�}t|�}|j�xR|D]J}ytj|d�Wntk
rsqFXtj	d|d|d��qFWdS(NR
itlastswinfo name .RcSs
t|�S(N(R=(tname((s./usr/lib64/python2.7/Demo/tkinter/guido/rmt.pyt<lambda>�t(
tfile_m_appstaddR*R4t
winfo_interpstlisttsortR6tTclErrortadd_command(tnamesR?((s./usr/lib64/python2.7/Demo/tkinter/guido/rmt.pytfillAppsMenu�s



	tpostcommand(1tTkintertsystTkR4R1tFrametRAISEDtmBartpacktXtftBOTHt	ScrollbartFLATtstRIGHTtYtTexttsetRtLEFTt
tag_configtyviewttitleticonnamet
MenubuttontfiletMenutfile_mRBtadd_cascadeRHtexitRtbindRR R$R(R+R#R7R=RJt
tk_menuBarR5R3tfocustmainloop(((s./usr/lib64/python2.7/Demo/tkinter/guido/rmt.pyt<module>s^
		'



												


PK�
Q\�+�$RRguido/optionmenu.pycnu�[����
��^c@s�ddlTe�Ze�Zejd�eeeddd�Zej�dZ	e�Z
e
je	d
�eeee
fee	��Z
e
j�ej�dS(
i����(t*tOnetTwotThreetAahtBeetCeetDeetEffiN(RRRRR(tTkintertTktroott	StringVartvar1tsett
OptionMenutmenu1tpacktCHOICEStvar2tapplyttupletmenu2tmainloop(((s5/usr/lib64/python2.7/Demo/tkinter/guido/optionmenu.pyt<module>s
		

	
PK�
Q\�m.,,
guido/kill.pynuȯ��#! /usr/bin/python2.7
# Tkinter interface to Linux `kill' command.

from Tkinter import *
from string import splitfields
from string import split
import commands
import os

class BarButton(Menubutton):
    def __init__(self, master=None, **cnf):
        apply(Menubutton.__init__, (self, master), cnf)
        self.pack(side=LEFT)
        self.menu = Menu(self, name='menu')
        self['menu'] = self.menu

class Kill(Frame):
    # List of (name, option, pid_column)
    format_list = [('Default', '', 0),
                   ('Long', '-l', 2),
                   ('User', '-u', 1),
                   ('Jobs', '-j', 1),
                   ('Signal', '-s', 1),
                   ('Memory', '-m', 0),
                   ('VM', '-v', 0),
                   ('Hex', '-X', 0)]
    def kill(self, selected):
        c = self.format_list[self.format.get()][2]
        pid = split(selected)[c]
        os.system('kill -9 ' + pid)
        self.do_update()
    def do_update(self):
        name, option, column = self.format_list[self.format.get()]
        s = commands.getoutput('ps -w ' + option)
        list = splitfields(s, '\n')
        self.header.set(list[0])
        del list[0]
        y = self.frame.vscroll.get()[0]
        self.frame.list.delete(0, AtEnd())
        for line in list:
            self.frame.list.insert(0, line)
        self.frame.list.yview(int(y))
    def do_motion(self, e):
        e.widget.select_clear(0, END)
        e.widget.select_set(e.widget.nearest(e.y))
    def do_leave(self, e):
        e.widget.select_clear(0, END)
    def do_1(self, e):
        self.kill(e.widget.get(e.widget.nearest(e.y)))
    def __init__(self, master=None, **cnf):
        Frame.__init__(self, master, cnf)
        self.pack(expand=1, fill=BOTH)
        self.bar = Frame(self, name='bar', relief=RAISED,
                         borderwidth=2)
        self.bar.pack(fill=X)
        self.bar.file = BarButton(self.bar, text='File')
        self.bar.file.menu.add_command(
                label='Quit', command=self.quit)
        self.bar.view = BarButton(self.bar, text='View')
        self.format = IntVar(self)
        self.format.set(2)
        for num in range(len(self.format_list)):
            self.bar.view.menu.add_radiobutton(
                    label=self.format_list[num][0],
                    command=self.do_update,
                    variable=self.format,
                    value=num)
        #self.bar.view.menu.add_separator()
        #XXX ...
        self.bar.tk_menuBar(self.bar.file, self.bar.view)
        self.frame = Frame(self, relief=RAISED, borderwidth=2)
        self.frame.pack(expand=1, fill=BOTH)
        self.header = StringVar(self)
        self.frame.label = Label(self.frame, relief=FLAT, anchor=NW,
                                 borderwidth=0,
                                 textvariable=self.header)
        self.frame.label.pack(fill=X)
        self.frame.vscroll = Scrollbar(self.frame, orient=VERTICAL)
        self.frame.list = Listbox(self.frame, relief=SUNKEN,
                                  selectbackground='#eed5b7',
                                  selectborderwidth=0,
                                  yscroll=self.frame.vscroll.set)
        self.frame.vscroll['command'] = self.frame.list.yview
        self.frame.vscroll.pack(side=RIGHT, fill=Y)
        self.frame.list.pack(expand=1, fill=BOTH)
        self.update = Button(self, text="Update",
                             command=self.do_update)
        self.update.pack(expand=1, fill=X)
        self.frame.list.bind('<Motion>', self.do_motion)
        self.frame.list.bind('<Leave>', self.do_leave)
        self.frame.list.bind('<1>', self.do_1)
        self.do_update()

if __name__ == '__main__':
    kill = Kill(None, borderwidth=5)
    kill.winfo_toplevel().title('Tkinter Process Killer')
    kill.winfo_toplevel().minsize(1, 1)
    kill.mainloop()
PK�
Q\�|�D��guido/paint.pyonu�[����
��^c@s`dZddlTdad
\aad�Zd�Zd�Zd�Z	e
dkr\e�nd	S(sA"Paint program by Dave Michell.

Subject: tkinter "paint" example
From: Dave Mitchell <davem@magnet.com>
To: python-list@cwi.nl
Date: Fri, 23 Jan 1998 12:18:05 -0500 (EST)

  Not too long ago (last week maybe?) someone posted a request
for an example of a paint program using Tkinter. Try as I might
I can't seem to find it in the archive, so i'll just post mine
here and hope that the person who requested it sees this!

  All this does is put up a canvas and draw a smooth black line
whenever you have the mouse button down, but hopefully it will
be enough to start with.. It would be easy enough to add some
options like other shapes or colors...

                                                yours,
                                                dave mitchell
                                                davem@magnet.com
i����(t*tupcCs]t�}t|�}|j�|jdt�|jdt�|jdt�|j�dS(Ns<Motion>s<ButtonPress-1>s<ButtonRelease-1>(tTktCanvastpacktbindtmotiontb1downtb1uptmainloop(troottdrawing_area((s0/usr/lib64/python2.7/Demo/tkinter/guido/paint.pytmains	
cCs
dadS(Ntdown(tb1(tevent((s0/usr/lib64/python2.7/Demo/tkinter/guido/paint.pyR'scCsdadadadS(NR(RtNonetxoldtyold(R((s0/usr/lib64/python2.7/Demo/tkinter/guido/paint.pyR,scCsetdkratdk	rLtdk	rL|jjtt|j|jdt�n|ja|jandS(NR
tsmooth(	RRRRtwidgettcreate_linetxtytTRUE(R((s0/usr/lib64/python2.7/Demo/tkinter/guido/paint.pyR2s
(	t__main__N(NN(t__doc__tTkinterRRRRRRRRt__name__(((s0/usr/lib64/python2.7/Demo/tkinter/guido/paint.pyt<module>s
						PK�
Q\��V���
guido/rmt.pyonu�[����
Afc
@s�ddlTddlZe�ZejZeededd�Zejde	�ee�Z
e
jddde�ee
de
�Zejd	ede�ee
deddd
ejdd�Zejd	ededd�ejdd
d�ejed<ejd�ejd�eedddd�Zejd	e�ee�Zeed<eedd�Zejddddde�ejdddddej �d�Z!ej"de!�d�Z#ej"de#�d�Z$ej"d e$�d!�Z%ej"d"e%�d#�Z&ej"d$e&�d%�Z'ej"d&e'�ej"d'e'�ej"d(e'�d)�Z(d*�Z)d+�Z*d,�Z+e+ed-<ej,e�ej-�a.e)�ej/�ej0�dS(.i����(t*Ntrelieftborderwidthitfilltexpanditsidetyscrollcommandtsetgridtboldtfonts$-Adobe-Courier-Bold-R-Normal-*-120-*tcommandsTk Remote Controllers	Tk RemotettexttFilet	underlineitmenuttearofftlabelsSelect ApplicationtQuitcCs?|j}|j}tjdd�tjdt||��dS(Nstk_priv(selectMode)tchartanchor(txtytttsetvartmark_settAt(teRR((s./usr/lib64/python2.7/Demo/tkinter/guido/rmt.pytsingle15s		s<1>cCs<|j}|j}tjdd�tjt||��dS(Nstk_priv(selectMode)tword(RRRRttk_textSelectToR(RRR((s./usr/lib64/python2.7/Demo/tkinter/guido/rmt.pytdouble1=s		s
<Double-1>cCs<|j}|j}tjdd�tjt||��dS(Nstk_priv(selectMode)tline(RRRRRR(RRR((s./usr/lib64/python2.7/Demo/tkinter/guido/rmt.pyttriple1Ds		s
<Triple-1>cCstjt�d�t�dS(Ns
(RtinserttAtInserttinvoke(R((s./usr/lib64/python2.7/Demo/tkinter/guido/rmt.pyt	returnkeyKss<Return>cCsStjt�tj��tjt��tjt��ddkrOt�ndS(Ni����s.0(RR!R"t
selection_gettyview_pickplacetindexR#(R((s./usr/lib64/python2.7/Demo/tkinter/guido/rmt.pytcontrolvPss<Control-v>cCsHtjd�tjd�krDtjdt��tjt��ndS(Nt	promptEndsinsert - 1 char(RR'tdeleteR"R&(R((s./usr/lib64/python2.7/Demo/tkinter/guido/rmt.pyt	backspaceZss<BackSpace>s<Control-h>s<Delete>cCs�tjdt��}tjtjdd|��r�ttj�krZtjd|�}ntj	t|�}|r�tj
t�|d�nt�ntjt��dS(NspromptEnd + 1 chartinfotcompletetevals
(
RtgetR"t
getbooleanttktcalltapptroott
winfo_nametsendR!tpromptR&(tcmdtmsg((s./usr/lib64/python2.7/Demo/tkinter/guido/rmt.pyR#is
cCs>tjt�td�tjdd�tjddd�dS(Ns: R)sinsert - 1 charRsinsert linestart(RR!R"R3Rttag_add(((s./usr/lib64/python2.7/Demo/tkinter/guido/rmt.pyR7uscCsA|atjdd�tjd|d�tjddd�dS(NspromptEnd linestartR)t:R(R3RR*R!R:(tappName((s./usr/lib64/python2.7/Demo/tkinter/guido/rmt.pytnewApp~scCs�tjd�tjdd�tj�}t|�}|j�xR|D]J}ytj|d�Wntk
rsqFXtj	d|d|d��qFWdS(NR
itlastswinfo name .RcSs
t|�S(N(R=(tname((s./usr/lib64/python2.7/Demo/tkinter/guido/rmt.pyt<lambda>�t(
tfile_m_appstaddR*R4t
winfo_interpstlisttsortR6tTclErrortadd_command(tnamesR?((s./usr/lib64/python2.7/Demo/tkinter/guido/rmt.pytfillAppsMenu�s



	tpostcommand(1tTkintertsystTkR4R1tFrametRAISEDtmBartpacktXtftBOTHt	ScrollbartFLATtstRIGHTtYtTexttsetRtLEFTt
tag_configtyviewttitleticonnamet
MenubuttontfiletMenutfile_mRBtadd_cascadeRHtexitRtbindRR R$R(R+R#R7R=RJt
tk_menuBarR5R3tfocustmainloop(((s./usr/lib64/python2.7/Demo/tkinter/guido/rmt.pyt<module>s^
		'



												


PK�
Q\)t�MIMIguido/AttrDialog.pyonu�[����
��^c@sddlTddd��YZdefd��YZdefd��YZdefd	��YZd
efd��YZddd
��YZdefd��YZdefd��YZdefd��YZ	de	fd��YZ
d�Zd�Zd�Z
e�dS(i����(t*tOptioncBs5eZeZd�Zd�Zd�Zdd�ZRS(cCs�||_||_|j|_|j|\|_|_|j|j�|_t	|j�|_
|j
jdt�t
|j
d|d�|_|jjdt�|j�|j�dS(Ntfillttextt:tside(tdialogtoptionttoptmastertoptionstdefaulttklasstvarclasstvartFrametframetpacktXtLabeltlabeltLEFTtupdatet	addoption(tselfRR((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyt__init__s		
cCs|jj�|j�dS(N(RtrefreshR(R((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyR"s
cCsQy|jj|j|_Wntk
r9|j|_nX|jj|j�dS(N(RtcurrentRtKeyErrorRRtset(R((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyR&s

cCsdS(N((Rte((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyR-sN(	t__name__t
__module__t	StringVarR
RRRtNoneR(((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyRs
	
		t
BooleanOptioncBseZeZd�ZRS(cCsYt|jddddddd|jdtd	d
d|j�|_|jjdt�dS(
NRson/offtonvalueitoffvalueitvariabletrelieftborderwidthitcommandR(tCheckbuttonRRtRAISEDRtbuttonRtRIGHT(R((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyR4s	(RR t
BooleanVarR
R(((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyR#0st
EnumOptioncBseZd�ZRS(c
Cs�t|jd|jdtdd�|_|jjdt�t|j�|_|j|jd<xF|j	j
|jD]1}|jjd|d|jd	|d
|j
�qpWdS(NttextvariableR'R(iRtmenuRR&tvalueR)(t
MenubuttonRRR+R,RR-tMenuR1RtclassesRtadd_radiobuttonR(Rtv((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyRAs		(RR R(((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyR/?stStringOptioncBseZd�ZRS(c
Csft|jd|jdddtdd�|_|jjdtdtd	d
�|jjd|j	�dS(NR0twidthi
R'R(iRRtexpandis<Return>(
tEntryRRtSUNKENtentryRR-RtbindR(R((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyRQs	(RR R(((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyR8OstReadonlyOptioncBseZd�ZRS(cCs8t|jd|jdt�|_|jjdt�dS(NR0tanchorR(RRRtERRR-(R((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyR\s(RR R(((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyR?ZstDialogcBsPeZd�Zd�Zd�Zd�ZiZiZeZ	e
ZeZ
eZRS(cCsf||_|j�|j�t|j�|_|jj|jj�|jjdd�|j	�dS(Ni(
R	t
fixclassesRtToplevelRttitlet	__class__Rtminsizet
addchoices(RR	((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyRcs	

cCsdS(N((R((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyRltcCsdS(N((R((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyRCnRIcCsi|_g}x0|jj�D]\}}|j||f�qW|j�x�|D]�\}\}}y|j|}Wntk
r�d}nXt|�tkr�|j	}n9|dkr�|j
}n!|dkr�|j}n	|j}|||�|j|<qSWdS(Ntunknowntbooleantreadonly(
tchoicesR
titemstappendtsortR5Rttypet	TupleTypet
enumoptiont
booleanoptiontreadonlyoptiontstringoption(Rtlisttktdctdtctcl((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyRHps$	


	(RR RRRCRHR
R5R#RTR8RVR/RSR?RU(((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyRBas					t
PackDialogc
BsjeZd�Zd�Zdd*d��YZdeefd��YZdeefd��YZdee	fd	��YZ
d
eefd��YZi
d,d
6d-d6d.d6d/d6d0d6d1d6d2d6d3d6d4d6d5d 6d6d!6d7d"6d8d%6Zi	eeeeeeeeef	d6d&d6d'd6d&d(6eeeefd6d'd6d)d6eeeefd$6d'd6Z RS(9cCs||_tj||�dS(N(twidgetRBR(RR^((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyR�s	cCs?|jj�|_|jj�|jd<|jj|jd<dS(Ns.classs.name(R^tinfoRtwinfo_classt_w(R((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyR�st
packoptioncBseZdd�ZRS(cCse|jj�|_y*t|jjjdi|j|j6�Wn"tk
r`}|GH|j	�nXdS(N((
RtgetRtapplyRR^RRtTclErrorR(RRtmsg((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyR�sN(RR R"R(((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyRb�sRTcBseZRS((RR (((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyRT�sRScBseZRS((RR (((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyRS�sRVcBseZRS((RR (((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyRV�sRUcBseZRS((RR (((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyRU�stClasss.classtNames.nametWidgettaftertcentertAnchorR@tbeforetnotBooleanR:tnonetFillRtinitPadtipadxtipadytpadxtpadyRtSideRRKRLtExpandtpixel(N(NRg(NRh(NRi(RkRl(NRi(RnRo(RpRq(NRi(iRs(iRs(iRs(iRs(RRx(!RR RRRbR#RTR/RSR8RVR?RUR"R
tNtNERAtSEtStSWtWtNWtCENTERtNONERtYtBOTHtTOPR-tBOTTOMRR5(((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyR]�s>		

"tRemotePackDialogcBs�eZd�Zd�Zddd��YZdeefd��YZdeefd��YZdee	fd	��YZ
d
eefd��YZRS(
cCso||_||_||_|j�t|j�|_|jj|jd�|jjdd�|j�dS(Ns PackDialogi(	R	tappR^RRDRRERGRH(RR	R�R^((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyR�s			
cCs�y4|jjj|jj|jdd|j��}Wntk
rO}|GHdSXi}xFtdt|�d�D],}||d}||d}|||<qoW|jj|jdd|j�|d<|j|d	<||_	dS(
NRR_iiitwinfotclasss.classs.name(
R	ttkt	splitlisttsendR�R^RetrangetlenR(RtwordsRftdicttitkeyR2((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyR�s(
tremotepackoptioncBseZdd�ZRS(cCs�|jj�|_yN|jjj|jjdd|jjd|j|jjj	j
|j��Wn"tk
r�}|GH|j�nXdS(NRtconfigt-(
RRcRRR	R�R�R^RR�tmergeReR(RRRf((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyR�s		
N(RR R"R(((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyR��sRTcBseZRS((RR (((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyRT�sRScBseZRS((RR (((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyRS�sRVcBseZRS((RR (((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyRV�sRUcBseZRS((RR (((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyRU�s((
RR RRR�R#RTR/RSR8RVR?RU(((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyR��s	
	tWidgetDialogc
Bs�eZd�Zd�Zd�Zd�ZddTd��YZdeefd��YZdee	fd	��YZ
d
eefd��YZdee
fd
��YZi.eeeeeeeeef	d6dd6dd6dd6dd6dd6dd6dd6dd6dd 6dd!6dd"6dd#6d$d%6dd&6dd'6d(d)6dd*6d+d,6eeefd-6d.d/6dd06d1d26dd36d+d46d+d56eefd66dd76eeeee fd86d+d96d+d:6dd;6dd<6d=d>6dd?6dd@6ddA6ddB6d.dC6ddD6ddE6dFdG6dHdI6d.dJ6ddK6e!e"e#fdL6Z$ie%e&e'fdM6Z(ie%e'fdM6Z)ie(dN6e(dO6e(dP6e)dQ6e)dC6e(dR6e)dS6Z*RS(UcCs,||_|j�|_tj||�dS(N(R^R`RRBR(RR^((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyR�s	cCst|jj|j�rpi}xF|j|j|jfD]+}x"|j�D]}||||<qHWq5W||_ndS(N(t
addclassesthas_keyRR5tkeys(RR5R[RX((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyRCs	cCsI|jj�|_|j�|jj�|jd<|jj|jd<dS(Ns.classs.name(R^R�t
configurationRR`RRa(R((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyRs
cCs�i|_i|_x^|jj�D]M\}}t|�dkr"|d|j|<|d|df|j|<q"q"Wd|jd<d	|jd<dS(
NiiiRgs.classRhs.name(NRg(NRh(RR
R�RNR�R"(RRXR7((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyRs		"
twidgetoptioncBseZdd�ZRS(cCsU|jj�|_y|j|jj|j<Wn"tk
rP}|GH|j�nXdS(N(RRcRRR^RReR(RRRf((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyRsN(RR R"R(((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyR�sRTcBseZRS((RR (((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyRT%sRScBseZRS((RR (((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyRS&sRVcBseZRS((RR (((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyRV'sRUcBseZRS((RR (((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyRU(sRltintegertAspecttcolort
BackgroundtbitmaptBitmapRztBorderWidthRLRgtdoubletCloseEnoughR)tCommandRKtConfinetcursortCursortCursorWidthtDisabledForegroundtExportSelectiontfonttFontt
ForegroundtFromtgeometrytGeometrytHeightttimetInsertWidthtJustifytstringRtLengthR^tMenuNameRhtOffTimetOnTimetOrientRstRelieftRepeatDelaytRepeatIntervalt
ScrollCommandtScrollIncrementt	rectangletScrollRegiont	ShowValuetSetGridtSliderforegroundtSliderLengthtTexttTickIntervaltTotindext	UnderlineR&tVariabletValuetWidthtWraptStatetButtontRadiobuttonR*R;R3tSlider((+RR RRCRRR�R#RTR/RSR8RVR?RUR{R|RAR}R~RR�R�R�RR-t
HORIZONTALtVERTICALR+R<tFLATtRIDGEtGROOVER�tCHARtWORDR5tNORMALtACTIVEtDISABLEDt	_tristatet_bistateR�(((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyR��s�					
	"
tRemoteWidgetDialogcBs�eZd�Zd�Zddd��YZdeefd��YZdeefd��YZdee	fd	��YZ
d
eefd��YZRS(
cCsG||_||_|j|jdd|j�|_tj||�dS(NR�R�(R�R^R�RRBR(RR	R�R^((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyRks		cCs�y1|jjj|jj|j|jd��}Wntk
rL}|GHdSXi}xL|D]D}|jjj|�}|dd}|f|d}|||<qZW||_|j�|j	|j
d<|j|j
d<dS(NR�iis.classs.name(R	R�R�R�R�R^ReR�RRR(RRNRfR�titemR�R�R2((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyRts$
	
tremotewidgetoptioncBseZdd�ZRS(cCst|jj�|_y9|jjj|jj|jjdd|j|j�Wn"t	k
ro}|GH|j
�nXdS(NR�R�(RRcRRR	R�R�R^RReR(RRRf((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyR�s		
N(RR R"R(((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyR��sRTcBseZRS((RR (((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyRT�sRScBseZRS((RR (((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyRS�sRVcBseZRS((RR (((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyRV�sRUcBseZRS((RR (((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyRU�s((
RR RRR�R#RTR/RSR8RVR?RU(((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyR�is			cCsddl}t�}|jdd�|jdrIt||jd�n�t|dd�}|jdddt�t|dddd�}|jdd�t	|dd	�}|j�t
|�}t|�}t
|�}t|�}t
|�}	t|�}
|j�dS(
Ni����itnameRR:RR,Rtcanvas(
tsystTkRGtargvt
remotetestRRR�R�tCanvasR]R�tmainloop(R�trootRR,R�tfpdtfwdtbpdtbwdtcpdtcwd((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyttest�s$	

cCs<ddlm}|||�}|jdt�||_dS(Ni����(tlisttrees<Any-Double-1>(R�R>topendialogsR�(R�R�R�RW((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyR��scCs�ddl}|j}|j�}x�|D]}|j|�}|j|�d}t||j|�|dkruq(nyt||j|�Wq(tk
r�}|GHq(Xq(WdS(Ni����it.(	R�R^tcurselectionRctsplitR�R�R�Re(RR�RWtselR�R�R^Rf((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyR��s	
N(((tTkinterRR#R/R8R?RBR]R�R�R�R�R�R�(((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyt<module>s
.67m2			PK�
Q\E�7��guido/listtree.pynu�[���# List a remote app's widget tree (names and classes only)

import sys
import string

from Tkinter import *

def listtree(master, app):
    list = Listbox(master, name='list')
    list.pack(expand=1, fill=BOTH)
    listnodes(list, app, '.', 0)
    return list

def listnodes(list, app, widget, level):
    klass = list.send(app, 'winfo', 'class', widget)
##      i = string.rindex(widget, '.')
##      list.insert(END, '%s%s (%s)' % ((level-1)*'.   ', widget[i:], klass))
    list.insert(END, '%s (%s)' % (widget, klass))
    children = list.tk.splitlist(
            list.send(app, 'winfo', 'children', widget))
    for c in children:
        listnodes(list, app, c, level+1)

def main():
    if not sys.argv[1:]:
        sys.stderr.write('Usage: listtree appname\n')
        sys.exit(2)
    app = sys.argv[1]
    tk = Tk()
    tk.minsize(1, 1)
    f = Frame(tk, name='f')
    f.pack(expand=1, fill=BOTH)
    list = listtree(f, app)
    tk.mainloop()

if __name__ == '__main__':
    main()
PK�
Q\)t�MIMIguido/AttrDialog.pycnu�[����
��^c@sddlTddd��YZdefd��YZdefd��YZdefd	��YZd
efd��YZddd
��YZdefd��YZdefd��YZdefd��YZ	de	fd��YZ
d�Zd�Zd�Z
e�dS(i����(t*tOptioncBs5eZeZd�Zd�Zd�Zdd�ZRS(cCs�||_||_|j|_|j|\|_|_|j|j�|_t	|j�|_
|j
jdt�t
|j
d|d�|_|jjdt�|j�|j�dS(Ntfillttextt:tside(tdialogtoptionttoptmastertoptionstdefaulttklasstvarclasstvartFrametframetpacktXtLabeltlabeltLEFTtupdatet	addoption(tselfRR((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyt__init__s		
cCs|jj�|j�dS(N(RtrefreshR(R((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyR"s
cCsQy|jj|j|_Wntk
r9|j|_nX|jj|j�dS(N(RtcurrentRtKeyErrorRRtset(R((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyR&s

cCsdS(N((Rte((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyR-sN(	t__name__t
__module__t	StringVarR
RRRtNoneR(((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyRs
	
		t
BooleanOptioncBseZeZd�ZRS(cCsYt|jddddddd|jdtd	d
d|j�|_|jjdt�dS(
NRson/offtonvalueitoffvalueitvariabletrelieftborderwidthitcommandR(tCheckbuttonRRtRAISEDRtbuttonRtRIGHT(R((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyR4s	(RR t
BooleanVarR
R(((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyR#0st
EnumOptioncBseZd�ZRS(c
Cs�t|jd|jdtdd�|_|jjdt�t|j�|_|j|jd<xF|j	j
|jD]1}|jjd|d|jd	|d
|j
�qpWdS(NttextvariableR'R(iRtmenuRR&tvalueR)(t
MenubuttonRRR+R,RR-tMenuR1RtclassesRtadd_radiobuttonR(Rtv((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyRAs		(RR R(((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyR/?stStringOptioncBseZd�ZRS(c
Csft|jd|jdddtdd�|_|jjdtdtd	d
�|jjd|j	�dS(NR0twidthi
R'R(iRRtexpandis<Return>(
tEntryRRtSUNKENtentryRR-RtbindR(R((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyRQs	(RR R(((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyR8OstReadonlyOptioncBseZd�ZRS(cCs8t|jd|jdt�|_|jjdt�dS(NR0tanchorR(RRRtERRR-(R((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyR\s(RR R(((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyR?ZstDialogcBsPeZd�Zd�Zd�Zd�ZiZiZeZ	e
ZeZ
eZRS(cCsf||_|j�|j�t|j�|_|jj|jj�|jjdd�|j	�dS(Ni(
R	t
fixclassesRtToplevelRttitlet	__class__Rtminsizet
addchoices(RR	((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyRcs	

cCsdS(N((R((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyRltcCsdS(N((R((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyRCnRIcCsi|_g}x0|jj�D]\}}|j||f�qW|j�x�|D]�\}\}}y|j|}Wntk
r�d}nXt|�tkr�|j	}n9|dkr�|j
}n!|dkr�|j}n	|j}|||�|j|<qSWdS(Ntunknowntbooleantreadonly(
tchoicesR
titemstappendtsortR5Rttypet	TupleTypet
enumoptiont
booleanoptiontreadonlyoptiontstringoption(Rtlisttktdctdtctcl((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyRHps$	


	(RR RRRCRHR
R5R#RTR8RVR/RSR?RU(((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyRBas					t
PackDialogc
BsjeZd�Zd�Zdd*d��YZdeefd��YZdeefd��YZdee	fd	��YZ
d
eefd��YZi
d,d
6d-d6d.d6d/d6d0d6d1d6d2d6d3d6d4d6d5d 6d6d!6d7d"6d8d%6Zi	eeeeeeeeef	d6d&d6d'd6d&d(6eeeefd6d'd6d)d6eeeefd$6d'd6Z RS(9cCs||_tj||�dS(N(twidgetRBR(RR^((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyR�s	cCs?|jj�|_|jj�|jd<|jj|jd<dS(Ns.classs.name(R^tinfoRtwinfo_classt_w(R((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyR�st
packoptioncBseZdd�ZRS(cCse|jj�|_y*t|jjjdi|j|j6�Wn"tk
r`}|GH|j	�nXdS(N((
RtgetRtapplyRR^RRtTclErrorR(RRtmsg((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyR�sN(RR R"R(((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyRb�sRTcBseZRS((RR (((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyRT�sRScBseZRS((RR (((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyRS�sRVcBseZRS((RR (((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyRV�sRUcBseZRS((RR (((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyRU�stClasss.classtNames.nametWidgettaftertcentertAnchorR@tbeforetnotBooleanR:tnonetFillRtinitPadtipadxtipadytpadxtpadyRtSideRRKRLtExpandtpixel(N(NRg(NRh(NRi(RkRl(NRi(RnRo(RpRq(NRi(iRs(iRs(iRs(iRs(RRx(!RR RRRbR#RTR/RSR8RVR?RUR"R
tNtNERAtSEtStSWtWtNWtCENTERtNONERtYtBOTHtTOPR-tBOTTOMRR5(((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyR]�s>		

"tRemotePackDialogcBs�eZd�Zd�Zddd��YZdeefd��YZdeefd��YZdee	fd	��YZ
d
eefd��YZRS(
cCso||_||_||_|j�t|j�|_|jj|jd�|jjdd�|j�dS(Ns PackDialogi(	R	tappR^RRDRRERGRH(RR	R�R^((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyR�s			
cCs�y4|jjj|jj|jdd|j��}Wntk
rO}|GHdSXi}xFtdt|�d�D],}||d}||d}|||<qoW|jj|jdd|j�|d<|j|d	<||_	dS(
NRR_iiitwinfotclasss.classs.name(
R	ttkt	splitlisttsendR�R^RetrangetlenR(RtwordsRftdicttitkeyR2((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyR�s(
tremotepackoptioncBseZdd�ZRS(cCs�|jj�|_yN|jjj|jjdd|jjd|j|jjj	j
|j��Wn"tk
r�}|GH|j�nXdS(NRtconfigt-(
RRcRRR	R�R�R^RR�tmergeReR(RRRf((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyR�s		
N(RR R"R(((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyR��sRTcBseZRS((RR (((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyRT�sRScBseZRS((RR (((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyRS�sRVcBseZRS((RR (((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyRV�sRUcBseZRS((RR (((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyRU�s((
RR RRR�R#RTR/RSR8RVR?RU(((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyR��s	
	tWidgetDialogc
Bs�eZd�Zd�Zd�Zd�ZddTd��YZdeefd��YZdee	fd	��YZ
d
eefd��YZdee
fd
��YZi.eeeeeeeeef	d6dd6dd6dd6dd6dd6dd6dd6dd6dd 6dd!6dd"6dd#6d$d%6dd&6dd'6d(d)6dd*6d+d,6eeefd-6d.d/6dd06d1d26dd36d+d46d+d56eefd66dd76eeeee fd86d+d96d+d:6dd;6dd<6d=d>6dd?6dd@6ddA6ddB6d.dC6ddD6ddE6dFdG6dHdI6d.dJ6ddK6e!e"e#fdL6Z$ie%e&e'fdM6Z(ie%e'fdM6Z)ie(dN6e(dO6e(dP6e)dQ6e)dC6e(dR6e)dS6Z*RS(UcCs,||_|j�|_tj||�dS(N(R^R`RRBR(RR^((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyR�s	cCst|jj|j�rpi}xF|j|j|jfD]+}x"|j�D]}||||<qHWq5W||_ndS(N(t
addclassesthas_keyRR5tkeys(RR5R[RX((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyRCs	cCsI|jj�|_|j�|jj�|jd<|jj|jd<dS(Ns.classs.name(R^R�t
configurationRR`RRa(R((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyRs
cCs�i|_i|_x^|jj�D]M\}}t|�dkr"|d|j|<|d|df|j|<q"q"Wd|jd<d	|jd<dS(
NiiiRgs.classRhs.name(NRg(NRh(RR
R�RNR�R"(RRXR7((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyRs		"
twidgetoptioncBseZdd�ZRS(cCsU|jj�|_y|j|jj|j<Wn"tk
rP}|GH|j�nXdS(N(RRcRRR^RReR(RRRf((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyRsN(RR R"R(((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyR�sRTcBseZRS((RR (((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyRT%sRScBseZRS((RR (((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyRS&sRVcBseZRS((RR (((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyRV'sRUcBseZRS((RR (((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyRU(sRltintegertAspecttcolort
BackgroundtbitmaptBitmapRztBorderWidthRLRgtdoubletCloseEnoughR)tCommandRKtConfinetcursortCursortCursorWidthtDisabledForegroundtExportSelectiontfonttFontt
ForegroundtFromtgeometrytGeometrytHeightttimetInsertWidthtJustifytstringRtLengthR^tMenuNameRhtOffTimetOnTimetOrientRstRelieftRepeatDelaytRepeatIntervalt
ScrollCommandtScrollIncrementt	rectangletScrollRegiont	ShowValuetSetGridtSliderforegroundtSliderLengthtTexttTickIntervaltTotindext	UnderlineR&tVariabletValuetWidthtWraptStatetButtontRadiobuttonR*R;R3tSlider((+RR RRCRRR�R#RTR/RSR8RVR?RUR{R|RAR}R~RR�R�R�RR-t
HORIZONTALtVERTICALR+R<tFLATtRIDGEtGROOVER�tCHARtWORDR5tNORMALtACTIVEtDISABLEDt	_tristatet_bistateR�(((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyR��s�					
	"
tRemoteWidgetDialogcBs�eZd�Zd�Zddd��YZdeefd��YZdeefd��YZdee	fd	��YZ
d
eefd��YZRS(
cCsG||_||_|j|jdd|j�|_tj||�dS(NR�R�(R�R^R�RRBR(RR	R�R^((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyRks		cCs�y1|jjj|jj|j|jd��}Wntk
rL}|GHdSXi}xL|D]D}|jjj|�}|dd}|f|d}|||<qZW||_|j�|j	|j
d<|j|j
d<dS(NR�iis.classs.name(R	R�R�R�R�R^ReR�RRR(RRNRfR�titemR�R�R2((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyRts$
	
tremotewidgetoptioncBseZdd�ZRS(cCst|jj�|_y9|jjj|jj|jjdd|j|j�Wn"t	k
ro}|GH|j
�nXdS(NR�R�(RRcRRR	R�R�R^RReR(RRRf((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyR�s		
N(RR R"R(((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyR��sRTcBseZRS((RR (((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyRT�sRScBseZRS((RR (((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyRS�sRVcBseZRS((RR (((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyRV�sRUcBseZRS((RR (((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyRU�s((
RR RRR�R#RTR/RSR8RVR?RU(((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyR�is			cCsddl}t�}|jdd�|jdrIt||jd�n�t|dd�}|jdddt�t|dddd�}|jdd�t	|dd	�}|j�t
|�}t|�}t
|�}t|�}t
|�}	t|�}
|j�dS(
Ni����itnameRR:RR,Rtcanvas(
tsystTkRGtargvt
remotetestRRR�R�tCanvasR]R�tmainloop(R�trootRR,R�tfpdtfwdtbpdtbwdtcpdtcwd((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyttest�s$	

cCs<ddlm}|||�}|jdt�||_dS(Ni����(tlisttrees<Any-Double-1>(R�R>topendialogsR�(R�R�R�RW((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyR��scCs�ddl}|j}|j�}x�|D]}|j|�}|j|�d}t||j|�|dkruq(nyt||j|�Wq(tk
r�}|GHq(Xq(WdS(Ni����it.(	R�R^tcurselectionRctsplitR�R�R�Re(RR�RWtselR�R�R^Rf((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyR��s	
N(((tTkinterRR#R/R8R?RBR]R�R�R�R�R�R�(((s5/usr/lib64/python2.7/Demo/tkinter/guido/AttrDialog.pyt<module>s
.67m2			PK�
Q\�Ծ��READMEnu�[���Several collections of example code for Tkinter.

See the toplevel README for an explanation of the difference between
Tkinter and _tkinter, how to enable the Python Tk interface, and where
to get Matt Conway's lifesaver document.

Subdirectories:

guido		my original example set (fairly random collection)
matt		Matt Conway's examples, to go with his lifesaver document
ttk         Examples using the ttk module
PK�
Q\�j:�^^ttk/plastik_theme.pyonu�[����
��^c@s�dZddlZddlZddlZddlmZdgZidd6dd6d	d
6dd6ZiZd
�Z	d�Z
dS(ssThis demonstrates good part of the syntax accepted by theme_create.

This is a translation of plastik.tcl to python.
You will need the images used by the plastik theme to test this. The
images (and other tile themes) can be retrived by doing:

$ cvs -z3 -d:pserver:anonymous@tktable.cvs.sourceforge.net:/cvsroot/tktable   co tile-themes

To test this module you should do, for example:

import Tkinter
import plastik_theme

root = Tkinter.Tk()
plastik_theme.install(plastik_image_dir)
...

Where plastik_image_dir contains the path to the images directory used by
the plastik theme, something like: tile-themes/plastik/plastik
i����N(t
PhotoImagetinstalls#efefeftframes#aaaaaat
disabledfgs#657a9etselectbgs#fffffftselectfgcCs�tjj|�}tjj|�s7td|��nxWtjd|�D]B}tjj|�d}|d }t|d|dd�t|<qKWdS(Ns(%r is not a directory, can't load imagess%s/*.gifii����tfiletformattgif89(	tostpatht
expandusertisdirt	ExceptiontglobtsplitRtimgs(timgdirtftimgtname((s6/usr/lib64/python2.7/Demo/tkinter/ttk/plastik_theme.pyt
_load_imgs%s
cCs=t|�tj�}|jdddi'iitdd6tdd6tdd6td	d
6tdd6dd
6dd6d6idtdfgd6d6d6ididd6dd6fdidd6dd6fdidd6dd6fdidd6didd 6dd!6d"idd6fgd#6fgd#6fgd$6d%6id&id'd6dd6fd(id)d6dd6fd&id)d6dd6fd*id+d6d,idd 6dd!6d-idd6fgd#6fgd#6fgd$6d.6iid/d06d1d26d6d3id4id5id6id'd6dd 6fgd#6fgd#6fgd#6fgd$6d76iid1d26d6d8id9id:id;id'd6dd 6fgd#6fgd#6fgd#6fgd$6d<6id=id>id)d6fd?id@idAid'd6dd 6fgd#6fgd#6fgd#6fgd$6dB6iidCdDdCdCgdE6d6dF6iidGdDdGdDgdH6dCdCdDgd 6d6idIddDdJdDgfgd 6d6dK6iidCdH6d6dL6idMdNd�d�idJd/gdS6dJdH6dTd6fdU6d36idMdVd�d�d�idJdYgdS6dZdH6d[d6fdU6d96idMd\d�d�d�d�idd6fdU6da6idMdbd�d�d�d�idd6fdU6dg6idMdhidZdS6d+d6fdU6d,6id�dU6d-6id�dU6d*6idMdkidZdS6dd6fdU6d6id�dU6d"6id�dU6d6idMdnd�idd6fdU6dp6idMdqd�idd6fdU6ds6idMdtd�idd6fdU6dv6idMdwd�idd6fdU6dy6idMdzidd6fdU6d{6idMd|iddS6dCdH6fdU6d}6idMd~idd6fdU6d6idMd�iddS6dCdH6fdU6d�6idMd�d�idDdS6dZdJgdH6d[d6fdU6d�6idMdSidJdS6dJdH6d[d6fdU6d�6idMd�d�id[d6dJdGd�d�gdS6dJdJd�gdH6fdU6d=6idMd�id�d6d�dCdCdCgdS6fdU6d>6idMd�d�d�d�d�d�idJdGd�d�gdS6dJdJd�gdH6d[d6fdU6d�6idMd�id�d6d�dCdCdCgdS6fdU6d�6idMd�idJdS6fdU6d�6idMd�d�d�idCdDdCdCgdH6dJd/dJd/gdS6fdU6d�6idMd�idDdS6fdU6d�6idMd�idDdYgdS6fdU6d�6idMd�idYdDgdS6fdU6d�6idMd�d�idJd/gdS6dJdH6d[d6fdU6d�6�|jd�dS(�NtplastiktdefaulttsettingsRt
backgroundttroughcolorRtselectbackgroundRtselectforegroundtfieldbackgroundt
TkDefaultFonttfontitborderwidtht	configuretdisabledRt
foregroundtmapt.sVertical.Scrollbar.uparrowttoptsidettstickysVertical.Scrollbar.downarrowtbottomsVertical.Scrollbar.troughtnssVertical.Scrollbar.thumbtexpandtunitsVertical.Scrollbar.griptchildrentlayoutsVertical.TScrollbarsHorizontal.Scrollbar.leftarrowtleftsHorizontal.Scrollbar.rightarrowtrightsHorizontal.Scrollbar.troughtewsHorizontal.Scrollbar.thumbsHorizontal.Scrollbar.gripsHorizontal.TScrollbari
twidthtcentertanchors
Button.buttonsButton.focussButton.paddingsButton.labeltTButtonsToolbutton.bordersToolbutton.buttonsToolbutton.paddingsToolbutton.labelt
ToolbuttonsMenubutton.buttonsMenubutton.indicatorsMenubutton.focussMenubutton.paddingsMenubutton.labeltTMenubuttoniit
tabmarginst	TNotebookitpaddingtselectedis
TNotebook.tabtTreeviewtimagesbutton-ntpressedsbutton-ptactivesbutton-htbordertewnsselement creates	tbutton-ns	tbutton-ps	tbutton-hi	itnewsscheck-nuscheck-hcscheck-pcscheck-huscheck-ncsCheckbutton.indicatorsradio-nusradio-hcsradio-pcsradio-husradio-ncsRadiobutton.indicatorshsb-nshsb-gshsb-tsvsb-nsvsb-gsvsb-ts	arrowup-ns	arrowup-psScrollbar.uparrowsarrowdown-nsarrowdown-psScrollbar.downarrowsarrowleft-nsarrowleft-psScrollbar.leftarrowsarrowright-nsarrowright-psScrollbar.rightarrows	hslider-nsHorizontal.Scale.sliders	hslider-tsHorizontal.Scale.troughs	vslider-nsVertical.Scale.sliders	vslider-tsVertical.Scale.troughsentry-ntfocussentry-fsEntry.fieldsLabelframe.borderscombo-rscombo-raiiisarrow-dtescombo-ntreadonlyscombo-fascombo-as	!readonlyscombo-fsCombobox.fieldsCombobox.downarrows
notebook-csNotebook.clientsnotebook-tnsnotebook-tssnotebook-tasNotebook.tabshprogress-tsProgressbar.troughshprogress-bsHorizontal.Progressbar.pbarsvprogress-bsVertical.Progressbar.pbarstree-nstree-psTreeheading.cell(R?sbutton-p(R@sbutton-h(R<s	tbutton-p(R?s	tbutton-p(R@s	tbutton-h(R@R<scheck-hc(R?R<scheck-pc(R@scheck-hu(R<scheck-nc(R@R<sradio-hc(R?R<sradio-pc(R@sradio-hu(R<sradio-nc(R>shsb-g(R>shsb-t(R>svsb-g(R>svsb-t(R?s	arrowup-p(R?sarrowdown-p(R?sarrowleft-p(R?sarrowright-p(RDsentry-f(R@scombo-ra(RFR@scombo-ra(RDR@scombo-fa(R@scombo-a(s	!readonlyRDscombo-f(RFscombo-r(R<snotebook-ts(R@snotebook-ta(R?stree-p(RtttktStylettheme_createtcolorst	theme_use(Rtstyle((s6/usr/lib64/python2.7/Demo/tkinter/ttk/plastik_theme.pyR.s

/
/@@@!*'))""	"")).&.4!!-(t__doc__R	RRGtTkinterRt__all__RJRRR(((s6/usr/lib64/python2.7/Demo/tkinter/ttk/plastik_theme.pyt<module>s	
		PK�
Q\��qP�
�
ttk/dirbrowser.pynu�[���"""A directory browser using Ttk Treeview.

Based on the demo found in Tk 8.5 library/demos/browse
"""
import os
import glob
import Tkinter
import ttk

def populate_tree(tree, node):
    if tree.set(node, "type") != 'directory':
        return

    path = tree.set(node, "fullpath")
    tree.delete(*tree.get_children(node))

    parent = tree.parent(node)
    special_dirs = [] if parent else glob.glob('.') + glob.glob('..')

    for p in special_dirs + os.listdir(path):
        ptype = None
        p = os.path.join(path, p).replace('\\', '/')
        if os.path.isdir(p): ptype = "directory"
        elif os.path.isfile(p): ptype = "file"

        fname = os.path.split(p)[1]
        id = tree.insert(node, "end", text=fname, values=[p, ptype])

        if ptype == 'directory':
            if fname not in ('.', '..'):
                tree.insert(id, 0, text="dummy")
                tree.item(id, text=fname)
        elif ptype == 'file':
            size = os.stat(p).st_size
            tree.set(id, "size", "%d bytes" % size)


def populate_roots(tree):
    dir = os.path.abspath('.').replace('\\', '/')
    node = tree.insert('', 'end', text=dir, values=[dir, "directory"])
    populate_tree(tree, node)

def update_tree(event):
    tree = event.widget
    populate_tree(tree, tree.focus())

def change_dir(event):
    tree = event.widget
    node = tree.focus()
    if tree.parent(node):
        path = os.path.abspath(tree.set(node, "fullpath"))
        if os.path.isdir(path):
            os.chdir(path)
            tree.delete(tree.get_children(''))
            populate_roots(tree)

def autoscroll(sbar, first, last):
    """Hide and show scrollbar as needed."""
    first, last = float(first), float(last)
    if first <= 0 and last >= 1:
        sbar.grid_remove()
    else:
        sbar.grid()
    sbar.set(first, last)

root = Tkinter.Tk()

vsb = ttk.Scrollbar(orient="vertical")
hsb = ttk.Scrollbar(orient="horizontal")

tree = ttk.Treeview(columns=("fullpath", "type", "size"),
    displaycolumns="size", yscrollcommand=lambda f, l: autoscroll(vsb, f, l),
    xscrollcommand=lambda f, l:autoscroll(hsb, f, l))

vsb['command'] = tree.yview
hsb['command'] = tree.xview

tree.heading("#0", text="Directory Structure", anchor='w')
tree.heading("size", text="File Size", anchor='w')
tree.column("size", stretch=0, width=100)

populate_roots(tree)
tree.bind('<<TreeviewOpen>>', update_tree)
tree.bind('<Double-Button-1>', change_dir)

# Arrange the tree and its scrollbars in the toplevel
tree.grid(column=0, row=0, sticky='nswe')
vsb.grid(column=1, row=0, sticky='ns')
hsb.grid(column=0, row=1, sticky='ew')
root.grid_columnconfigure(0, weight=1)
root.grid_rowconfigure(0, weight=1)

root.mainloop()
PK�
Q\Rh�|@@ttk/listbox_scrollcmd.pyonu�[����
��^c@sWdZddlZddlZej�Zejdd�Zejdddddd	�ejd
ej	dd�Z
e
jed
<e
jdddddd�ejdddd�Z
e
jdddddd�ej�Zejdddddd�ejddd�ejddd�x(ed�D]Zejdde�q+Wej�dS(sWSample taken from: http://www.tkdocs.com/tutorial/morewidgets.html and
converted to Python, mainly to demonstrate xscrollcommand option.

grid [tk::listbox .l -yscrollcommand ".s set" -height 5] -column 0 -row 0 -sticky nwes
grid [ttk::scrollbar .s -command ".l yview" -orient vertical] -column 1 -row 0 -sticky ns
grid [ttk::label .stat -text "Status message here" -anchor w] -column 0 -row 1 -sticky we
grid [ttk::sizegrip .sz] -column 1 -row 1 -sticky se
grid columnconfigure . 0 -weight 1; grid rowconfigure . 0 -weight 1
for {set i 0} {$i<100} {incr i} {
   .l insert end "Line $i of 100"
   }
i����NtheightitcolumnitrowtstickytnwestcommandtorienttverticaltyscrollcommanditnsttextsStatus message heretanchortwtwetsetweightidtendsLine %d of 100(t__doc__tTkintertttktTktroottListboxtltgridt	ScrollbartyviewtstsettLabeltstattSizegriptsztgrid_columnconfiguretgrid_rowconfiguretrangetitinserttmainloop(((s:/usr/lib64/python2.7/Demo/tkinter/ttk/listbox_scrollcmd.pyt<module>s"
PK�
Q\�-���ttk/listbox_scrollcmd.pynu�[���"""Sample taken from: http://www.tkdocs.com/tutorial/morewidgets.html and
converted to Python, mainly to demonstrate xscrollcommand option.

grid [tk::listbox .l -yscrollcommand ".s set" -height 5] -column 0 -row 0 -sticky nwes
grid [ttk::scrollbar .s -command ".l yview" -orient vertical] -column 1 -row 0 -sticky ns
grid [ttk::label .stat -text "Status message here" -anchor w] -column 0 -row 1 -sticky we
grid [ttk::sizegrip .sz] -column 1 -row 1 -sticky se
grid columnconfigure . 0 -weight 1; grid rowconfigure . 0 -weight 1
for {set i 0} {$i<100} {incr i} {
   .l insert end "Line $i of 100"
   }
"""
import Tkinter
import ttk

root = Tkinter.Tk()

l = Tkinter.Listbox(height=5)
l.grid(column=0, row=0, sticky='nwes')

s = ttk.Scrollbar(command=l.yview, orient='vertical')
l['yscrollcommand'] = s.set
s.grid(column=1, row=0, sticky="ns")

stat = ttk.Label(text="Status message here", anchor='w')
stat.grid(column=0, row=1, sticky='we')

sz = ttk.Sizegrip()
sz.grid(column=1, row=1, sticky='se')

root.grid_columnconfigure(0, weight=1)
root.grid_rowconfigure(0, weight=1)

for i in range(100):
    l.insert('end', "Line %d of 100" % i)

root.mainloop()
PK�
Q\#��ggttk/treeview_multicolumn.pycnu�[����
��^c@s�dZddlZddlZddlZd6Zd7d8d9d:d;d<d=d>d?d@dAdBdCdDdEgZd1�Zd2efd3��YZd4�Z	e
d5kr�e	�ndS(FsCDemo based on the demo mclist included with tk source distribution.i����Ntcountrytcapitaltcurrencyt	ArgentinasBuenos AirestARSt	AustraliatCanberratAUDtBraziltBraziliatBRLtCanadatOttawatCADtChinatBeijingtCNYtFrancetParistEURtGermanytBerlintIndias	New DelhitINRtItalytRometJapantTokyotJPYtMexicosMexico CitytMXNtRussiatMoscowtRUBsSouth AfricatPretoriatZARsUnited KingdomtLondontGBPs
United StatessWashington, D.C.tUSDcs�g�jd�D]}�j||�|f^q}|jd��x1t|�D]#\}}�j|dd|�qQW�j|d|��fd��dS(s/Sort tree contents when a column is clicked on.ttreverseitcommandcst�|t���S(N(tsortbytint(tcol(t
descendingttree(s=/usr/lib64/python2.7/Demo/tkinter/ttk/treeview_multicolumn.pyt<lambda>%R'N(tget_childrentsettsortt	enumeratetmovetheading(R.R,R-tchildtdatatindxtitem((R-R.s=/usr/lib64/python2.7/Demo/tkinter/ttk/treeview_multicolumn.pyR*s4tAppcBs#eZd�Zd�Zd�ZRS(cCs!d|_|j�|j�dS(N(tNoneR.t_setup_widgetst_build_tree(tself((s=/usr/lib64/python2.7/Demo/tkinter/ttk/treeview_multicolumn.pyt__init__(s	
cCsetjdddddddd$dd�}|jd
d�tj�}|jd
ddt�tjdtdd�|_tjddd|jj	�}tjddd|jj
�}|jjd|jd|j�|jj
ddddddd|�|j
dd dddd!d|�|j
dddd dd"d|�|jdd#d �|jdd#d �dS(%Nt
wraplengtht4itjustifytlefttanchortntpaddingi
iittexts�Ttk is the new Tk themed widget set. One of the widgets it includes is a tree widget, which can be configured to display multiple columns of informational data without displaying the tree itself. This is a simple way to build a listbox that has multiple columns. Clicking on the heading for a column will sort the data by that column. You can also change the width of the columns by dragging the boundary between them.tfilltxtbothtexpandtcolumnstshowtheadingstorienttverticalR)t
horizontaltyscrollcommandtxscrollcommandtcolumnitrowtstickytnsewtin_itnstewtweight(i
ii
i(tttktLabeltpacktFrametTruetTreeviewttree_columnsR.t	Scrollbartyviewtxviewt	configureR1tgridtgrid_columnconfiguretgrid_rowconfigure(R>tmsgt	containertvsbthsb((s=/usr/lib64/python2.7/Demo/tkinter/ttk/treeview_multicolumn.pyR<-s	%""c	s	xgtD]_}�jj|d|j�d|�fd���jj|dtj�j|j���qWx�tD]�}�jj	ddd|�xnt
|�D]`\}}tj�j|�}�jjt|dd�|kr��jjt|d|�q�q�WqqWdS(NRGR)cst�j|d�S(Ni(R*R.(tc(R>(s=/usr/lib64/python2.7/Demo/tkinter/ttk/treeview_multicolumn.pyR/MR'twidthR'tendtvalues(RbR.R5ttitleRTttkFonttFonttmeasuret	tree_datatinsertR3R;(R>R,R9R8tvaltilen((R>s=/usr/lib64/python2.7/Demo/tkinter/ttk/treeview_multicolumn.pyR=Js
/
"(t__name__t
__module__R?R<R=(((s=/usr/lib64/python2.7/Demo/tkinter/ttk/treeview_multicolumn.pyR:'s		cCs�tj�}|jd�|jd�ddl}y|jd�Wn*tk
roddl}|jd�nXt	�}|j
�dS(NsMulti-Column Listtmclisti����s~/tile-themes/plastik/plastiks'plastik theme being used without images(tTkintertTktwm_titletwm_iconnamet
plastik_themetinstallt	ExceptiontwarningstwarnR:tmainloop(trootR�R�tapp((s=/usr/lib64/python2.7/Demo/tkinter/ttk/treeview_multicolumn.pytmain[s


	t__main__(RRR(RsBuenos AiresR(RRR(RR	R
(RRR
(RRR(RRR(RRR(Rs	New DelhiR(RRR(RRR(RsMexico CityR(RR R!(sSouth AfricaR"R#(sUnited KingdomR$R%(s
United StatessWashington, D.C.R&(t__doc__R}RsR\RbRvR*tobjectR:R�Rz(((s=/usr/lib64/python2.7/Demo/tkinter/ttk/treeview_multicolumn.pyt<module>s0		4	PK�
Q\��"�P
P
ttk/widget_state.pycnu�[����
��^c	@s�dZddlZddddddd	d
dg	Zx eD]Zejde�q;Wd
�Zdejfd��YZd�Ze	dkr�e�ndS(s8Sample demo showing widget states and some font styling.i����Ntactivetdisabledtfocustpressedtselectedt
backgroundtreadonlyt	alternatetinvalidt!cCs%ttt�d}|j|�dS(Ni(tstatestlentstate(twidgettnostate((s5/usr/lib64/python2.7/Demo/tkinter/ttk/widget_state.pytreset_state
stAppcBs2eZdd�Zdd�Zd�Zd�ZRS(cCstjj|dd�|jj|�tj�|_|jjdd�}t|j	j
d|��}|j	j
d|�|_d|jkr�d|j|_n|d	d
kr�|d	nd|_t
||d	d
kr�dnd	�|_g|_|j�dS(
NtborderwidthitTButtontfontsfont configure %s -sizesfont configure %s -familyt s{%s}it-ti(tttktFramet__init__tmasterttitletStyletstyletlookuptstrttktevaltfont_familytfsize_prefixtintt
base_fsizetupdate_widgetst_setup_widgets(tselfRtbtn_fonttfsize((s5/usr/lib64/python2.7/Demo/tkinter/ttk/widget_state.pyRs#)	icCs4|jjddd|j|j|j|f�dS(NRRs%s %s%d(Rt	configureR"R#R%(R(textra((s5/usr/lib64/python2.7/Demo/tkinter/ttk/widget_state.pyt	_set_font#scCs�|j|�}|s'dg}d}nGt|j��}g|D]}|tkr@|^q@}dt|�}x(|jD]}t|�|j|�qxW|j|�dS(NRiii(	tnametowidgettsettsplitR
RR&RRR-(R(R
tnewtextt
goodstatest
font_extrat	newstatesR((s5/usr/lib64/python2.7/Demo/tkinter/ttk/widget_state.pyt
_new_state's		%

c	Cs�tj|dd�}tj|dddd�}|j|j�ddf|d	<|j�|jj|�|j�|j	d
ddd
�|j	dddd
dd
dd�|j	d
ddd�dS(NttextsEnter states and watchtcursortxtermtvalidatetkeys%Ws%Ptvalidatecommandtfilltxtpadxitsidetlefttpadytanchortntbothtexpandi(
RtButtontEntrytregisterR5RR&tappendR9tpack(R(tbtntentry((s5/usr/lib64/python2.7/Demo/tkinter/ttk/widget_state.pyR'?s

"N(t__name__t
__module__tNoneRR-R5R'(((s5/usr/lib64/python2.7/Demo/tkinter/ttk/widget_state.pyRs	cCstd�}|j�dS(NsWidget State Tester(Rtmainloop(tapp((s5/usr/lib64/python2.7/Demo/tkinter/ttk/widget_state.pytmainNst__main__(
t__doc__RR
RRIRRRRRRM(((s5/usr/lib64/python2.7/Demo/tkinter/ttk/widget_state.pyt<module>s	@	PK�
Q\Rh�|@@ttk/listbox_scrollcmd.pycnu�[����
��^c@sWdZddlZddlZej�Zejdd�Zejdddddd	�ejd
ej	dd�Z
e
jed
<e
jdddddd�ejdddd�Z
e
jdddddd�ej�Zejdddddd�ejddd�ejddd�x(ed�D]Zejdde�q+Wej�dS(sWSample taken from: http://www.tkdocs.com/tutorial/morewidgets.html and
converted to Python, mainly to demonstrate xscrollcommand option.

grid [tk::listbox .l -yscrollcommand ".s set" -height 5] -column 0 -row 0 -sticky nwes
grid [ttk::scrollbar .s -command ".l yview" -orient vertical] -column 1 -row 0 -sticky ns
grid [ttk::label .stat -text "Status message here" -anchor w] -column 0 -row 1 -sticky we
grid [ttk::sizegrip .sz] -column 1 -row 1 -sticky se
grid columnconfigure . 0 -weight 1; grid rowconfigure . 0 -weight 1
for {set i 0} {$i<100} {incr i} {
   .l insert end "Line $i of 100"
   }
i����NtheightitcolumnitrowtstickytnwestcommandtorienttverticaltyscrollcommanditnsttextsStatus message heretanchortwtwetsetweightidtendsLine %d of 100(t__doc__tTkintertttktTktroottListboxtltgridt	ScrollbartyviewtstsettLabeltstattSizegriptsztgrid_columnconfiguretgrid_rowconfiguretrangetitinserttmainloop(((s:/usr/lib64/python2.7/Demo/tkinter/ttk/listbox_scrollcmd.pyt<module>s"
PK�
Q\�O���ttk/dirbrowser.pycnu�[����
��^c	@s�dZddlZddlZddlZddlZd�Zd�Zd�Zd�Zd�Z	ej
�Zejdd	�Z
ejdd
�Zejdd)dddd�dd��Zeje
d<ejed<ejddddd�ejddddd�ejddddd�ee�ejde�ejd e�ejd!dd"dd#d$�e
jd!d%d"dd#d&�ejd!dd"d%d#d'�ejdd(d%�ejdd(d%�ej�dS(*s`A directory browser using Ttk Treeview.

Based on the demo found in Tk 8.5 library/demos/browse
i����Nc
	Cs�|j|d�dkrdS|j|d�}|j|j|��|j|�}|r_gntjd�tjd�}x1|tj|�D]}d}tjj	||�j
dd�}tjj|�r�d}ntjj|�r�d}ntjj
|�d	}|j|d
d|d||g�}|dkrs|dkr�|j|d
dd�|j|d|�q�q�|dkr�tj|�j}	|j|dd|	�q�q�WdS(Nttypet	directorytfullpatht.s..s\t/tfileitendttexttvaluesitdummytsizes%d bytes(Rs..(tsettdeletetget_childrentparenttglobtostlistdirtNonetpathtjointreplacetisdirtisfiletsplittinserttitemtstattst_size(
ttreetnodeRRtspecial_dirstptptypetfnametidR
((s3/usr/lib64/python2.7/Demo/tkinter/ttk/dirbrowser.pyt
populate_tree
s,(!		$cCsStjjd�jdd�}|jddd|d|dg�}t||�dS(	NRs\RtRRRR(RRtabspathRRR$(RtdirR((s3/usr/lib64/python2.7/Demo/tkinter/ttk/dirbrowser.pytpopulate_roots&s$cCs |j}t||j��dS(N(twidgetR$tfocus(teventR((s3/usr/lib64/python2.7/Demo/tkinter/ttk/dirbrowser.pytupdate_tree+s	cCs�|j}|j�}|j|�r�tjj|j|d��}tjj|�r�tj|�|j	|j
d��t|�q�ndS(NRR%(R)R*RRRR&RRtchdirRR
R((R+RRR((s3/usr/lib64/python2.7/Demo/tkinter/ttk/dirbrowser.pyt
change_dir/s	
cCs\t|�t|�}}|dkr>|dkr>|j�n
|j�|j||�dS(s"Hide and show scrollbar as needed.iiN(tfloattgrid_removetgridR(tsbartfirsttlast((s3/usr/lib64/python2.7/Demo/tkinter/ttk/dirbrowser.pyt
autoscroll9s


torienttverticalt
horizontaltcolumnsRRR
tdisplaycolumnstyscrollcommandcCstt||�S(N(R5tvsb(tftl((s3/usr/lib64/python2.7/Demo/tkinter/ttk/dirbrowser.pyt<lambda>HR%txscrollcommandcCstt||�S(N(R5thsb(R=R>((s3/usr/lib64/python2.7/Demo/tkinter/ttk/dirbrowser.pyR?IR%tcommands#0RsDirectory Structuretanchortws	File Sizetstretchitwidthids<<TreeviewOpen>>s<Double-Button-1>tcolumntrowtstickytnsweitnstewtweight(RRR
(t__doc__RRtTkintertttkR$R(R,R.R5tTktroott	ScrollbarR<RAtTreeviewRtyviewtxviewtheadingRGtbindR1tgrid_columnconfiguretgrid_rowconfiguretmainloop(((s3/usr/lib64/python2.7/Demo/tkinter/ttk/dirbrowser.pyt<module>s:				
		


PK�
Q\w�%>>ttk/theme_selector.pyonu�[����
��^c@sZdZddlZddlZdejfd��YZd�ZedkrVe�ndS(s�Ttk Theme Selector v2.

This is an improvement from the other theme selector (themes_combo.py)
since now you can notice theme changes in Ttk Combobox, Ttk Frame,
Ttk Label and Ttk Button.
i����NtAppcBs,eZd�Zd�Zd�Zd�ZRS(cCsHtjj|dd�tj�|_tj|d�|_|j�dS(Ntborderwidthii(	tttktFramet__init__tStyletstyletTkintertIntVarttheme_autochanget_setup_widgets(tself((s7/usr/lib64/python2.7/Demo/tkinter/ttk/theme_selector.pyRscCs|jj|jj��dS(N(Rt	theme_usetthemes_combotget(R((s7/usr/lib64/python2.7/Demo/tkinter/ttk/theme_selector.pyt
_change_themescCs |jj�r|j�ndS(N(R	RR(Rtwidget((s7/usr/lib64/python2.7/Demo/tkinter/ttk/theme_selector.pyt_theme_sel_changedscCs�tj|dd�}|jj�}tj|d|dd�|_|jj|d�|jjd|j�tj	|ddd	|j
�}tj|dd
d|j�}|j
dd
dd�|jj
dddddd
dd�|j
dddddd
dd�|j
dddddddd
�|j�}|jddd�|jddd�|jddd�|j
dddddddddd�dS(NttexttThemestvalueststatetreadonlyis<<ComboboxSelected>>sChange Themetcommands-Change themes when combobox item is activatedtvariabletipadxitstickytwtrowtcolumnitpadxtewitet
columnspanitpadytweighttnsewtrowspan(RtLabelRttheme_namestComboboxR
tsettbindRtButtonRtCheckbuttonR	tgridtwinfo_topleveltrowconfiguretcolumnconfigure(Rt
themes_lbltthemest
change_btnttheme_change_checkbtnttop((s7/usr/lib64/python2.7/Demo/tkinter/ttk/theme_selector.pyR
s&%""(t__name__t
__module__RRRR
(((s7/usr/lib64/python2.7/Demo/tkinter/ttk/theme_selector.pyR
s	
		cCs't�}|jjd�|j�dS(NsTheme Selector(Rtmasterttitletmainloop(tapp((s7/usr/lib64/python2.7/Demo/tkinter/ttk/theme_selector.pytmain7s	t__main__(t__doc__RRRRR<R6(((s7/usr/lib64/python2.7/Demo/tkinter/ttk/theme_selector.pyt<module>s-	PK�
Q\a�O���ttk/theme_selector.pynu�[���"""Ttk Theme Selector v2.

This is an improvement from the other theme selector (themes_combo.py)
since now you can notice theme changes in Ttk Combobox, Ttk Frame,
Ttk Label and Ttk Button.
"""
import Tkinter
import ttk

class App(ttk.Frame):
    def __init__(self):
        ttk.Frame.__init__(self, borderwidth=3)

        self.style = ttk.Style()

        # XXX Ideally I wouldn't want to create a Tkinter.IntVar to make
        #     it works with Checkbutton variable option.
        self.theme_autochange = Tkinter.IntVar(self, 0)
        self._setup_widgets()

    def _change_theme(self):
        self.style.theme_use(self.themes_combo.get())

    def _theme_sel_changed(self, widget):
        if self.theme_autochange.get():
            self._change_theme()

    def _setup_widgets(self):
        themes_lbl = ttk.Label(self, text="Themes")

        themes = self.style.theme_names()
        self.themes_combo = ttk.Combobox(self, values=themes, state="readonly")
        self.themes_combo.set(themes[0])
        self.themes_combo.bind("<<ComboboxSelected>>", self._theme_sel_changed)

        change_btn = ttk.Button(self, text='Change Theme',
            command=self._change_theme)

        theme_change_checkbtn = ttk.Checkbutton(self,
            text="Change themes when combobox item is activated",
            variable=self.theme_autochange)

        themes_lbl.grid(ipadx=6, sticky="w")
        self.themes_combo.grid(row=0, column=1, padx=6, sticky="ew")
        change_btn.grid(row=0, column=2, padx=6, sticky="e")
        theme_change_checkbtn.grid(row=1, columnspan=3, sticky="w", pady=6)

        top = self.winfo_toplevel()
        top.rowconfigure(0, weight=1)
        top.columnconfigure(0, weight=1)
        self.columnconfigure(1, weight=1)
        self.grid(row=0, column=0, sticky="nsew", columnspan=3, rowspan=2)


def main():
    app = App()
    app.master.title("Theme Selector")
    app.mainloop()

if __name__ == "__main__":
    main()
PK�
Q\��"�P
P
ttk/widget_state.pyonu�[����
��^c	@s�dZddlZddddddd	d
dg	Zx eD]Zejde�q;Wd
�Zdejfd��YZd�Ze	dkr�e�ndS(s8Sample demo showing widget states and some font styling.i����Ntactivetdisabledtfocustpressedtselectedt
backgroundtreadonlyt	alternatetinvalidt!cCs%ttt�d}|j|�dS(Ni(tstatestlentstate(twidgettnostate((s5/usr/lib64/python2.7/Demo/tkinter/ttk/widget_state.pytreset_state
stAppcBs2eZdd�Zdd�Zd�Zd�ZRS(cCstjj|dd�|jj|�tj�|_|jjdd�}t|j	j
d|��}|j	j
d|�|_d|jkr�d|j|_n|d	d
kr�|d	nd|_t
||d	d
kr�dnd	�|_g|_|j�dS(
NtborderwidthitTButtontfontsfont configure %s -sizesfont configure %s -familyt s{%s}it-ti(tttktFramet__init__tmasterttitletStyletstyletlookuptstrttktevaltfont_familytfsize_prefixtintt
base_fsizetupdate_widgetst_setup_widgets(tselfRtbtn_fonttfsize((s5/usr/lib64/python2.7/Demo/tkinter/ttk/widget_state.pyRs#)	icCs4|jjddd|j|j|j|f�dS(NRRs%s %s%d(Rt	configureR"R#R%(R(textra((s5/usr/lib64/python2.7/Demo/tkinter/ttk/widget_state.pyt	_set_font#scCs�|j|�}|s'dg}d}nGt|j��}g|D]}|tkr@|^q@}dt|�}x(|jD]}t|�|j|�qxW|j|�dS(NRiii(	tnametowidgettsettsplitR
RR&RRR-(R(R
tnewtextt
goodstatest
font_extrat	newstatesR((s5/usr/lib64/python2.7/Demo/tkinter/ttk/widget_state.pyt
_new_state's		%

c	Cs�tj|dd�}tj|dddd�}|j|j�ddf|d	<|j�|jj|�|j�|j	d
ddd
�|j	dddd
dd
dd�|j	d
ddd�dS(NttextsEnter states and watchtcursortxtermtvalidatetkeys%Ws%Ptvalidatecommandtfilltxtpadxitsidetlefttpadytanchortntbothtexpandi(
RtButtontEntrytregisterR5RR&tappendR9tpack(R(tbtntentry((s5/usr/lib64/python2.7/Demo/tkinter/ttk/widget_state.pyR'?s

"N(t__name__t
__module__tNoneRR-R5R'(((s5/usr/lib64/python2.7/Demo/tkinter/ttk/widget_state.pyRs	cCstd�}|j�dS(NsWidget State Tester(Rtmainloop(tapp((s5/usr/lib64/python2.7/Demo/tkinter/ttk/widget_state.pytmainNst__main__(
t__doc__RR
RRIRRRRRRM(((s5/usr/lib64/python2.7/Demo/tkinter/ttk/widget_state.pyt<module>s	@	PK�
Q\xa��##ttk/roundframe.pyonu�[����
��^c	@s�dZddlZddlZej�Zejddd�Zejddd�Zej�Z	e	j
dd	dd%ddd
d�e	jddidd
6fg�e	jddd�ej
dddd�Zejdd�ej
dddd�Zejdddd�ejedd�Zejdd�ejdd��ejdd��ejeddd d!d"d�Zejdddd�ejdd#��ejdd$��ej�dS(&shTtk Frame with rounded corners.

Based on an example by Bryan Oakley, found at: http://wiki.tcl.tk/20152i����NtframeFocusBordertdatas�
R0lGODlhQABAAPcAAHx+fMTCxKSipOTi5JSSlNTS1LSytPTy9IyKjMzKzKyq
rOzq7JyanNza3Ly6vPz6/ISChMTGxKSmpOTm5JSWlNTW1LS2tPT29IyOjMzO
zKyurOzu7JyenNze3Ly+vPz+/OkAKOUA5IEAEnwAAACuQACUAAFBAAB+AFYd
QAC0AABBAAB+AIjMAuEEABINAAAAAHMgAQAAAAAAAAAAAKjSxOIEJBIIpQAA
sRgBMO4AAJAAAHwCAHAAAAUAAJEAAHwAAP+eEP8CZ/8Aif8AAG0BDAUAAJEA
AHwAAIXYAOfxAIESAHwAAABAMQAbMBZGMAAAIEggJQMAIAAAAAAAfqgaXESI
5BdBEgB+AGgALGEAABYAAAAAAACsNwAEAAAMLwAAAH61MQBIAABCM8B+AAAU
AAAAAAAApQAAsf8Brv8AlP8AQf8Afv8AzP8A1P8AQf8AfgAArAAABAAADAAA
AACQDADjAAASAAAAAACAAADVABZBAAB+ALjMwOIEhxINUAAAANIgAOYAAIEA
AHwAAGjSAGEEABYIAAAAAEoBB+MAAIEAAHwCACABAJsAAFAAAAAAAGjJAGGL
AAFBFgB+AGmIAAAQAABHAAB+APQoAOE/ABIAAAAAAADQAADjAAASAAAAAPiF
APcrABKDAAB8ABgAGO4AAJAAqXwAAHAAAAUAAJEAAHwAAP8AAP8AAP8AAP8A
AG0pIwW3AJGSAHx8AEocI/QAAICpAHwAAAA0SABk6xaDEgB8AAD//wD//wD/
/wD//2gAAGEAABYAAAAAAAC0/AHj5AASEgAAAAA01gBkWACDTAB8AFf43PT3
5IASEnwAAOAYd+PuMBKQTwB8AGgAEGG35RaSEgB8AOj/NOL/ZBL/gwD/fMkc
q4sA5UGpEn4AAIg02xBk/0eD/358fx/4iADk5QASEgAAAALnHABkAACDqQB8
AMyINARkZA2DgwB8fBABHL0AAEUAqQAAAIAxKOMAPxIwAAAAAIScAOPxABIS
AAAAAIIAnQwA/0IAR3cAACwAAAAAQABAAAAI/wA/CBxIsKDBgwgTKlzIsKFD
gxceNnxAsaLFixgzUrzAsWPFCw8kDgy5EeQDkBxPolypsmXKlx1hXnS48UEH
CwooMCDAgIJOCjx99gz6k+jQnkWR9lRgYYDJkAk/DlAgIMICZlizat3KtatX
rAsiCNDgtCJClQkoFMgqsu3ArBkoZDgA8uDJAwk4bGDmtm9BZgcYzK078m4D
Cgf4+l0skNkGCg3oUhR4d4GCDIoZM2ZWQMECyZQvLMggIbPmzQIyfCZ5YcME
AwFMn/bLLIKBCRtMHljQQcDV2ZqZTRDQYfWFAwMqUJANvC8zBhUWbDi5YUAB
Bsybt2VGoUKH3AcmdP+Im127xOcJih+oXsEDdvOLuQfIMGBD9QwBlsOnzcBD
hfrsuVfefgzJR599A+CnH4Hb9fcfgu29x6BIBgKYYH4DTojQc/5ZGGGGGhpU
IYIKghgiQRw+GKCEJxZIwXwWlthiQyl6KOCMLsJIIoY4LlQjhDf2mNCI9/Eo
5IYO2sjikX+9eGCRCzL5V5JALillY07GaOSVb1G5ookzEnlhlFx+8OOXZb6V
5Y5kcnlmckGmKaaMaZrpJZxWXjnnlmW++WGdZq5ZXQEetKmnlxPgl6eUYhJq
KKOI0imnoNbF2ScFHQJJwW99TsBAAAVYWEAAHEQAZoi1cQDqAAeEV0EACpT/
JqcACgRQAW6uNWCbYKcyyEwGDBgQwa2tTlBBAhYIQMFejC5AgQAWJNDABK3y
loEDEjCgV6/aOcYBAwp4kIF6rVkXgAEc8IQZVifCBRQHGqya23HGIpsTBgSU
OsFX/PbrVVjpYsCABA4kQCxHu11ogAQUIOAwATpBLDFQFE9sccUYS0wAxD5h
4DACFEggbAHk3jVBA/gtTIHHEADg8sswxyzzzDQDAAEECGAQsgHiTisZResN
gLIHBijwLQEYePzx0kw37fTSSjuMr7ZMzfcgYZUZi58DGsTKwbdgayt22GSP
bXbYY3MggQIaONDzAJ8R9kFlQheQQAAOWGCAARrwdt23Bn8H7vfggBMueOEG
WOBBAAkU0EB9oBGUdXIFZJBABAEEsPjmmnfO+eeeh/55BBEk0Ph/E8Q9meQq
bbDABAN00EADFRRQ++2254777rr3jrvjFTTQwQCpz7u6QRut5/oEzA/g/PPQ
Ry/99NIz//oGrZpUUEAAOw==tframeBorders�
R0lGODlhQABAAPcAAHx+fMTCxKSipOTi5JSSlNTS1LSytPTy9IyKjMzKzKyq
rOzq7JyanNza3Ly6vPz6/ISChMTGxKSmpOTm5JSWlNTW1LS2tPT29IyOjMzO
zKyurOzu7JyenNze3Ly+vPz+/OkAKOUA5IEAEnwAAACuQACUAAFBAAB+AFYd
QAC0AABBAAB+AIjMAuEEABINAAAAAHMgAQAAAAAAAAAAAKjSxOIEJBIIpQAA
sRgBMO4AAJAAAHwCAHAAAAUAAJEAAHwAAP+eEP8CZ/8Aif8AAG0BDAUAAJEA
AHwAAIXYAOfxAIESAHwAAABAMQAbMBZGMAAAIEggJQMAIAAAAAAAfqgaXESI
5BdBEgB+AGgALGEAABYAAAAAAACsNwAEAAAMLwAAAH61MQBIAABCM8B+AAAU
AAAAAAAApQAAsf8Brv8AlP8AQf8Afv8AzP8A1P8AQf8AfgAArAAABAAADAAA
AACQDADjAAASAAAAAACAAADVABZBAAB+ALjMwOIEhxINUAAAANIgAOYAAIEA
AHwAAGjSAGEEABYIAAAAAEoBB+MAAIEAAHwCACABAJsAAFAAAAAAAGjJAGGL
AAFBFgB+AGmIAAAQAABHAAB+APQoAOE/ABIAAAAAAADQAADjAAASAAAAAPiF
APcrABKDAAB8ABgAGO4AAJAAqXwAAHAAAAUAAJEAAHwAAP8AAP8AAP8AAP8A
AG0pIwW3AJGSAHx8AEocI/QAAICpAHwAAAA0SABk6xaDEgB8AAD//wD//wD/
/wD//2gAAGEAABYAAAAAAAC0/AHj5AASEgAAAAA01gBkWACDTAB8AFf43PT3
5IASEnwAAOAYd+PuMBKQTwB8AGgAEGG35RaSEgB8AOj/NOL/ZBL/gwD/fMkc
q4sA5UGpEn4AAIg02xBk/0eD/358fx/4iADk5QASEgAAAALnHABkAACDqQB8
AMyINARkZA2DgwB8fBABHL0AAEUAqQAAAIAxKOMAPxIwAAAAAIScAOPxABIS
AAAAAIIAnQwA/0IAR3cAACwAAAAAQABAAAAI/wA/CBxIsKDBgwgTKlzIsKFD
gxceNnxAsaLFixgzUrzAsWPFCw8kDgy5EeQDkBxPolypsmXKlx1hXnS48UEH
CwooMCDAgIJOCjx99gz6k+jQnkWR9lRgYYDJkAk/DlAgIMICkVgHLoggQIPT
ighVJqBQIKvZghkoZDgA8uDJAwk4bDhLd+ABBmvbjnzbgMKBuoA/bKDQgC1F
gW8XKMgQOHABBQsMI76wIIOExo0FZIhM8sKGCQYCYA4cwcCEDSYPLOgg4Oro
uhMEdOB84cCAChReB2ZQYcGGkxsGFGCgGzCFCh1QH5jQIW3xugwSzD4QvIIH
4s/PUgiQYcCG4BkC5P/ObpaBhwreq18nb3Z79+8Dwo9nL9I8evjWsdOX6D59
fPH71Xeef/kFyB93/sln4EP2Ebjegg31B5+CEDLUIH4PVqiQhOABqKFCF6qn
34cHcfjffCQaFOJtGaZYkIkUuljQigXK+CKCE3po40A0trgjjDru+EGPI/6I
Y4co7kikkAMBmaSNSzL5gZNSDjkghkXaaGIBHjwpY4gThJeljFt2WSWYMQpZ
5pguUnClehS4tuMEDARQgH8FBMBBBExGwIGdAxywXAUBKHCZkAIoEEAFp33W
QGl47ZgBAwZEwKigE1SQgAUCUDCXiwtQIIAFCTQwgaCrZeCABAzIleIGHDD/
oIAHGUznmXABGMABT4xpmBYBHGgAKGq1ZbppThgAG8EEAW61KwYMSOBAApdy
pNp/BkhAAQLcEqCTt+ACJW645I5rLrgEeOsTBtwiQIEElRZg61sTNBBethSw
CwEA/Pbr778ABywwABBAgAAG7xpAq6mGUUTdAPZ6YIACsRKAAbvtZqzxxhxn
jDG3ybbKFHf36ZVYpuE5oIGhHMTqcqswvyxzzDS/HDMHEiiggQMLDxCZXh8k
BnEBCQTggAUGGKCB0ktr0PTTTEfttNRQT22ABR4EkEABDXgnGUEn31ZABglE
EEAAWaeN9tpqt832221HEEECW6M3wc+Hga3SBgtMODBABw00UEEBgxdO+OGG
J4744oZzXUEDHQxwN7F5G7QRdXxPoPkAnHfu+eeghw665n1vIKhJBQUEADs=tRoundedFrametimagetfocustborderitstickytnsewtTEntrytborderwidthitstyletpaddingi
tfilltxtbothtexpandittexttTests	<FocusIn>cCstjdg�S(NR(tframetstate(tevt((s3/usr/lib64/python2.7/Demo/tkinter/ttk/roundframe.pyt<lambda>gts
<FocusOut>cCstjdg�S(Ns!focus(RR(R((s3/usr/lib64/python2.7/Demo/tkinter/ttk/roundframe.pyRhRtbgtwhitethighlightthicknesscCstjdg�S(NR(tframe2R(R((s3/usr/lib64/python2.7/Demo/tkinter/ttk/roundframe.pyRlRcCstjdg�S(Ns!focus(RR(R((s3/usr/lib64/python2.7/Demo/tkinter/ttk/roundframe.pyRmR(RR(t__doc__tTkintertttktTktroott
PhotoImagetimg1timg2tStyleRtelement_createtlayoutt	configuretFrameRtpackRtEntrytentrytbindtTextRtmainloop(((s3/usr/lib64/python2.7/Demo/tkinter/ttk/roundframe.pyt<module>s2&	$	 !PK�
Q\�^��ttk/treeview_multicolumn.pynu�[���"""Demo based on the demo mclist included with tk source distribution."""
import Tkinter
import tkFont
import ttk

tree_columns = ("country", "capital", "currency")
tree_data = [
    ("Argentina",      "Buenos Aires",     "ARS"),
    ("Australia",      "Canberra",         "AUD"),
    ("Brazil",         "Brazilia",         "BRL"),
    ("Canada",         "Ottawa",           "CAD"),
    ("China",          "Beijing",          "CNY"),
    ("France",         "Paris",            "EUR"),
    ("Germany",        "Berlin",           "EUR"),
    ("India",          "New Delhi",        "INR"),
    ("Italy",          "Rome",             "EUR"),
    ("Japan",          "Tokyo",            "JPY"),
    ("Mexico",         "Mexico City",      "MXN"),
    ("Russia",         "Moscow",           "RUB"),
    ("South Africa",   "Pretoria",         "ZAR"),
    ("United Kingdom", "London",           "GBP"),
    ("United States",  "Washington, D.C.", "USD")
    ]

def sortby(tree, col, descending):
    """Sort tree contents when a column is clicked on."""
    # grab values to sort
    data = [(tree.set(child, col), child) for child in tree.get_children('')]

    # reorder data
    data.sort(reverse=descending)
    for indx, item in enumerate(data):
        tree.move(item[1], '', indx)

    # switch the heading so that it will sort in the opposite direction
    tree.heading(col,
        command=lambda col=col: sortby(tree, col, int(not descending)))

class App(object):
    def __init__(self):
        self.tree = None
        self._setup_widgets()
        self._build_tree()

    def _setup_widgets(self):
        msg = ttk.Label(wraplength="4i", justify="left", anchor="n",
            padding=(10, 2, 10, 6),
            text=("Ttk is the new Tk themed widget set. One of the widgets it "
                  "includes is a tree widget, which can be configured to "
                  "display multiple columns of informational data without "
                  "displaying the tree itself. This is a simple way to build "
                  "a listbox that has multiple columns. Clicking on the "
                  "heading for a column will sort the data by that column. "
                  "You can also change the width of the columns by dragging "
                  "the boundary between them."))
        msg.pack(fill='x')

        container = ttk.Frame()
        container.pack(fill='both', expand=True)

        # XXX Sounds like a good support class would be one for constructing
        #     a treeview with scrollbars.
        self.tree = ttk.Treeview(columns=tree_columns, show="headings")
        vsb = ttk.Scrollbar(orient="vertical", command=self.tree.yview)
        hsb = ttk.Scrollbar(orient="horizontal", command=self.tree.xview)
        self.tree.configure(yscrollcommand=vsb.set, xscrollcommand=hsb.set)
        self.tree.grid(column=0, row=0, sticky='nsew', in_=container)
        vsb.grid(column=1, row=0, sticky='ns', in_=container)
        hsb.grid(column=0, row=1, sticky='ew', in_=container)

        container.grid_columnconfigure(0, weight=1)
        container.grid_rowconfigure(0, weight=1)

    def _build_tree(self):
        for col in tree_columns:
            self.tree.heading(col, text=col.title(),
                command=lambda c=col: sortby(self.tree, c, 0))
            # XXX tkFont.Font().measure expected args are incorrect according
            #     to the Tk docs
            self.tree.column(col, width=tkFont.Font().measure(col.title()))

        for item in tree_data:
            self.tree.insert('', 'end', values=item)

            # adjust columns lenghts if necessary
            for indx, val in enumerate(item):
                ilen = tkFont.Font().measure(val)
                if self.tree.column(tree_columns[indx], width=None) < ilen:
                    self.tree.column(tree_columns[indx], width=ilen)

def main():
    root = Tkinter.Tk()
    root.wm_title("Multi-Column List")
    root.wm_iconname("mclist")

    import plastik_theme
    try:
        plastik_theme.install('~/tile-themes/plastik/plastik')
    except Exception:
        import warnings
        warnings.warn("plastik theme being used without images")

    app = App()
    root.mainloop()

if __name__ == "__main__":
    main()
PK�
Q\��[���ttk/mac_searchentry.pynu�[���"""Mac style search widget

Translated from Tcl code by Schelte Bron, http://wiki.tcl.tk/18188
"""
import Tkinter
import ttk

root = Tkinter.Tk()

data = """
R0lGODlhKgAaAOfnAFdZVllbWFpcWVtdWlxeW11fXF9hXmBiX2ZnZWhpZ2lraGxua25wbXJ0
cXR2c3V3dHZ4dXh6d3x+e31/fH6AfYSGg4eJhoiKh4qMiYuNio2PjHmUqnqVq3yXrZGTkJKU
kX+asJSWk32cuJWXlIGcs5aYlX6euZeZloOetZial4SftpqbmIWgt4GhvYahuIKivpudmYei
uYOjv5yem4ijuoSkwIWlwYmlu56gnYamwp+hnoenw4unvaCin4ioxJCnuZykrImpxZmlsoaq
zI2pv6KkoZGouoqqxpqms4erzaOloo6qwYurx5Kqu5untIiszqSmo5CrwoysyJeqtpOrvJyo
tZGsw42typSsvaaopZKtxJWtvp6qt4+uy6epppOuxZCvzKiqp5quuZSvxoyx06mrqJWwx42y
1JKxzpmwwaqsqZaxyI6z1ZqxwqutqpOzz4+01qyuq56yvpizypS00Jm0y5W10Zq1zJa20rCy
rpu3zqizwbGzr6C3yZy4z7K0saG4yp250LO1sqK5y5660Z+70qO7zKy4xaC806S8zba4taG9
1KW9zq66x6+7yLi6t6S/1rC8yrm7uLO8xLG9y7q8ubS9xabB2anB07K+zLW+xrO/za7CzrTA
zrjAyLXBz77BvbbC0K/G2LjD0bnE0rLK28TGw8bIxcLL07vP28HN28rMycvOyr/T38DU4cnR
2s/RztHT0NLU0cTY5MrW5MvX5dHX2c3Z59bY1dPb5Nbb3dLe7Nvd2t3f3NXh797g3d3j5dnl
9OPl4eTm4+Ln6tzo9uXn5Obo5eDp8efp5uHq8uXq7ejq5+nr6OPs9Ovu6unu8O3v6+vw8+7w
7ezx9O/x7vDy7/Hz8O/19/P18vT38/L3+fb49Pf59vX6/fj69/b7/vn7+Pr8+ff9//v9+vz/
+/7//P//////////////////////////////////////////////////////////////////
/////////////////////////////////yH/C05FVFNDQVBFMi4wAwEAAAAh+QQJZAD/ACwC
AAIAKAAWAAAI/gD/CRz4bwUGCg8eQFjIsGHDBw4iTLAQgqBFgisuePCiyJOpUyBDihRpypMi
Lx8qaLhIMIyGFZ5sAUsmjZrNmzhzWpO2DJgtTysqfGDpxoMbW8ekeQsXzty4p1CjRjUXrps3
asJsuclQ4uKKSbamMR3n1JzZs2jRkh1HzuxVXX8y4CDYAwqua+DInVrRwMGJU2kDp31KThy1
XGWGDlxhi1rTPAUICBBAoEAesoIzn6Vm68MKgVAUHftmzhOCBCtQwQKSoABgzZnJdSMmyIPA
FbCotdUQAIhNa9B6DPCAGbZac+SowVIMRVe4pwkA4GpqDlwuAAmMZx4nTtfnf1mO5JEDNy46
MHJkxQEDgKC49rPjwC0bqGaZuOoZAKjBPE4NgAzUvYcWOc0QZF91imAnCDHJ5JFAAJN0I2Ba
4iRDUC/gOEVNDwIUcEABCAgAAATUTIgWOMBYRFp80ghiAQIIVAAEAwJIYI2JZnUji0XSYAYO
NcsQA8wy0hCTwAASXGOiONFcxAtpTokTHznfiLMNMAkcAMuE43jDC0vLeGOWe2R5o4sn1LgH
GzkWsvTPMgEOaA433Ag4TjjMuDkQMNi0tZ12sqWoJ0HATMPNffAZZ6U0wLAyqJ62RGoLLrhI
aqmlpzwaEAAh+QQJZAD/ACwAAAAAKgAaAAAI/gD/CRw40JEhQoEC+fGjcOHCMRAjRkxDsKLF
f5YcAcID582ZjyBDJhmZZIjJIUySEDHiBMhFghrtdNnRAgSHmzhz6sTZQcSLITx+CHn5bxSk
Nz5MCMGy55CjTVCjbuJEtSrVQ3uwqDBRQwrFi476SHHxow8qXcemVbPGtm21t3CnTaP27Jgu
VHtuiIjBsuImQkRiiEEFTNo2cOTMKV7MuLE5cN68QUOGSgwKG1EqJqJDY8+rZt8UjxtNunTj
cY3DgZOWS46KIFgGjiI0ZIsqaqNNjWjgYMUpx8Adc3v2aosNMAI1DbqyI9WycOb4IAggQEAB
A3lQBxet/TG4cMpI/tHwYeSfIzxM0uTKNs7UgAQrYL1akaDA7+3bueVqY4NJlUhIcQLNYx8E
AIQ01mwjTQ8DeNAdfouNA8440GBCQxJY3MEGD6p4Y844CQCAizcSgpMLAAlAuJ03qOyQRBR3
nEHEK+BMGKIui4kDDAAIPKiiYuSYSMQQRCDCxhiziPMYBgDkEaEaAGQA3Y+MjUPOLFoMoUUh
cKxRC4ngeILiH8Qkk0cCAUzSDZWpzbLEE1EwggcYqWCj2DNADFDAAQUgIAAAEFDDJmPYqNJF
F1s4cscTmCDjDTjdSPOHBQggUAEQDAgggTWDPoYMJkFoUdRmddyyjWLeULMMMcAsIw0x4wkM
IME1g25zyxpHxFYUHmyIggw4H4ojITnfiLMNMAkcAAub4BQjihRdDGTJHmvc4Qo1wD6Imje6
eILbj+BQ4wqu5Q3ECSJ0FOKKMtv4mBg33Pw4zjbKuBIIE1xYpIkhdQQiyi7OtAucj6dt48wu
otQhBRa6VvSJIRwhIkotvgRTzMUYZ6xxMcj4QkspeKDxxRhEmUfIHWjAgQcijEDissuXvCyz
zH7Q8YQURxDhUsn/bCInR3AELfTQZBRt9BBJkCGFFVhMwTNBlnBCSCGEIJQQIAklZMXWRBAR
RRRWENHwRQEBADs="""


s1 = Tkinter.PhotoImage("search1", data=data, format="gif -index 0")
s2 = Tkinter.PhotoImage("search2", data=data, format="gif -index 1")

style = ttk.Style()

style.element_create("Search.field", "image", "search1",
    ("focus", "search2"), border=[22, 7, 14], sticky="ew")

style.layout("Search.entry", [
    ("Search.field", {"sticky": "nswe", "border": 1, "children":
        [("Entry.padding", {"sticky": "nswe", "children":
            [("Entry.textarea", {"sticky": "nswe"})]
        })]
    })]
)

style.configure("Search.entry", background="#b2b2b2")

root.configure(background="#b2b2b2")

e1 = ttk.Entry(style="Search.entry", width=20)
e2 = ttk.Entry(style="Search.entry", width=20)

e1.grid(padx=10, pady=10)
e2.grid(padx=10, pady=10)

root.mainloop()
PK�
Q\�J"_��ttk/notebook_closebtn.pyonu�[����
��^c
@s�dZddlZddlZddlZej�Zejjejje	�d�Z
ejddejje
d��Zejddejje
d��Z
ejd	dejje
d
��Zej�Zejdddd8d9dddd�ejddidd6fg�ejddidd6didd6dd6didd6dd6didd6dd6fdidd6dd6fgd 6fgd 6fgd 6fg�d!�Zd"�Zejd#d$ee�ejd#d%e�ejd&d'd(d'd)d�Zde_ejed*d+�Zejed*d,�Zejed*d-�Zejed.d/d0d1�ejed.d2d0d1�ejed.d3d0d1�ej d4d5d6d7�ej!�dS(:saA Ttk Notebook with close buttons.

Based on an example by patthoyts, http://paste.tclers.tk/896
i����Ntimgt	img_closetfiles	close.giftimg_closeactivesclose_active.giftimg_closepressedsclose_pressed.giftclosetimagetactivetpresseds	!disabledtborderitstickyttButtonNotebooksButtonNotebook.clienttnswesButtonNotebook.TabsButtonNotebook.tabsButtonNotebook.paddingttoptsidesButtonNotebook.focussButtonNotebook.labeltleftsButtonNotebook.closetchildrencCst|j|j|j}}}|j||�}|jd||f�}d|krp|jdg�||_ndS(Ns@%d,%dRR(txtytwidgettidentifytindextstatet
pressed_index(teventRRRtelemR((s:/usr/lib64/python2.7/Demo/tkinter/ttk/notebook_closebtn.pyt	btn_press&scCs�|j|j|j}}}|jdg�s3dS|j||�}|jd||f�}d|kr�|j|kr�|j|�|jd�n|j	dg�d|_dS(NRs@%d,%dRs<<NotebookClosedTab>>s!pressed(RRRtinstateRRRtforgettevent_generateRtNone(RRRRRR((s:/usr/lib64/python2.7/Demo/tkinter/ttk/notebook_closebtn.pytbtn_release/s
t	TNotebooks<ButtonPress-1>s<ButtonRelease-1>twidthi�theighttstylet
backgroundtredtgreentbluettexttRedtpaddingitGreentBluetexpanditfilltboth(RRs	!disabledR(Rs	!disabledR("t__doc__tostTkintertttktTktroottpathtjointdirnamet__file__timgdirt
PhotoImageti1ti2ti3tStyleR$telement_createtlayoutRR t
bind_classtTruetNotebooktnbRRtFrametf1tf2tf3taddtpacktmainloop(((s:/usr/lib64/python2.7/Demo/tkinter/ttk/notebook_closebtn.pyt<module>sF!$ 	
<				PK�
Q\w�%>>ttk/theme_selector.pycnu�[����
��^c@sZdZddlZddlZdejfd��YZd�ZedkrVe�ndS(s�Ttk Theme Selector v2.

This is an improvement from the other theme selector (themes_combo.py)
since now you can notice theme changes in Ttk Combobox, Ttk Frame,
Ttk Label and Ttk Button.
i����NtAppcBs,eZd�Zd�Zd�Zd�ZRS(cCsHtjj|dd�tj�|_tj|d�|_|j�dS(Ntborderwidthii(	tttktFramet__init__tStyletstyletTkintertIntVarttheme_autochanget_setup_widgets(tself((s7/usr/lib64/python2.7/Demo/tkinter/ttk/theme_selector.pyRscCs|jj|jj��dS(N(Rt	theme_usetthemes_combotget(R((s7/usr/lib64/python2.7/Demo/tkinter/ttk/theme_selector.pyt
_change_themescCs |jj�r|j�ndS(N(R	RR(Rtwidget((s7/usr/lib64/python2.7/Demo/tkinter/ttk/theme_selector.pyt_theme_sel_changedscCs�tj|dd�}|jj�}tj|d|dd�|_|jj|d�|jjd|j�tj	|ddd	|j
�}tj|dd
d|j�}|j
dd
dd�|jj
dddddd
dd�|j
dddddd
dd�|j
dddddddd
�|j�}|jddd�|jddd�|jddd�|j
dddddddddd�dS(NttexttThemestvalueststatetreadonlyis<<ComboboxSelected>>sChange Themetcommands-Change themes when combobox item is activatedtvariabletipadxitstickytwtrowtcolumnitpadxtewitet
columnspanitpadytweighttnsewtrowspan(RtLabelRttheme_namestComboboxR
tsettbindRtButtonRtCheckbuttonR	tgridtwinfo_topleveltrowconfiguretcolumnconfigure(Rt
themes_lbltthemest
change_btnttheme_change_checkbtnttop((s7/usr/lib64/python2.7/Demo/tkinter/ttk/theme_selector.pyR
s&%""(t__name__t
__module__RRRR
(((s7/usr/lib64/python2.7/Demo/tkinter/ttk/theme_selector.pyR
s	
		cCs't�}|jjd�|j�dS(NsTheme Selector(Rtmasterttitletmainloop(tapp((s7/usr/lib64/python2.7/Demo/tkinter/ttk/theme_selector.pytmain7s	t__main__(t__doc__RRRRR<R6(((s7/usr/lib64/python2.7/Demo/tkinter/ttk/theme_selector.pyt<module>s-	PK�
Q\��$&$&ttk/ttkcalendar.pyonu�[����
��^c@s{dZddlZddlZddlZddlZd�Zdejfd��YZd�Ze	dkrwe�ndS(sQ
Simple calendar using ttk Treeview together with calendar and datetime
classes.
i����NcCs-|dkrtj|�Stj||�SdS(N(tNonetcalendartTextCalendartLocaleTextCalendar(tlocaletfwday((s4/usr/lib64/python2.7/Demo/tkinter/ttk/ttkcalendar.pytget_calendar
s
tCalendarcBs�eZejjZejjZdd�Zd�Zd�Zd�Z	d�Z
d�Zd�Zd�Z
d�Zd	�Zd
�Zd�Zd�Zed
��ZRS(c
KsY|jdtj�}|jd|jj�j�}|jd|jj�j�}|jdd�}|jdd�}|jdd�}|j||d	�|_d|_	t
jj|||�t
||�|_|j�|j�|j�|j||�gtd
�D]!}	|jjddd
d�^q|_|j�|jjd|j�dS(s�
        WIDGET-SPECIFIC OPTIONS

            locale, firstweekday, year, month, selectbackground,
            selectforeground
        tfirstweekdaytyeartmonthRtselectbackgrounds#ecffc4tselectforegrounds#05640eiittendtvaluess<Map>N(tpopRtMONDAYtdatetimetnowR	R
Rt_datet
_selectiontttktFramet__init__Rt_calt_Calendar__setup_stylest_Calendar__place_widgetst_Calendar__config_calendart_Calendar__setup_selectiontranget	_calendartinsertt_itemst_build_calendartbindt_Calendar__minsize(
tselftmastertkwRR	R
Rtsel_bgtsel_fgt_((s4/usr/lib64/python2.7/Demo/tkinter/ttk/ttkcalendar.pyRs$	


4
cCs�|dkrtd|��n]|dkr;||jd<nA|dkrf|jj|jjd|�ntjj|||�dS(	NR	R
sattribute '%s' is not writeableRt
backgroundRtitem(R	R
(tAttributeErrort_canvast
itemconfigurettextRRt__setitem__(R%R,tvalue((s4/usr/lib64/python2.7/Demo/tkinter/ttk/ttkcalendar.pyR1<scCs�|dkrt|j|�S|dkr3|jdS|dkrX|jj|jjd�Stjitjj||�|6�}||SdS(NR	R
RR+Rtfill(R	R
(	tgetattrRR.titemcgetR0Rt
tclobjs_to_pyRt__getitem__(R%R,tr((s4/usr/lib64/python2.7/Demo/tkinter/ttk/ttkcalendar.pyR7Fs%cCsKtj|j�}d�}|jd|d��|jd|d��dS(NcSs!did|dfgd6fgS(NsButton.focussButton.%sarrowtchildren(R(tdir((s4/usr/lib64/python2.7/Demo/tkinter/ttk/ttkcalendar.pyt<lambda>Tss	L.TButtontlefts	R.TButtontright(RtStyleR&tlayout(R%tstyletarrow_layout((s4/usr/lib64/python2.7/Demo/tkinter/ttk/ttkcalendar.pyt__setup_stylesQs	c	Cs&tj|�}tj|ddd|j�}tj|ddd|j�}tj|dddd�|_tjd	d
ddd
d�|_|j	d|dddddd�|j
d|�|jj
d|dddddd�|j
d|dddd�|jj	d|dddddd�dS(NR@s	L.TButtontcommands	R.TButtontwidthitanchortcentertshowR
t
selectmodetnonetheightitin_tsidettoptpadyitcolumnitrowitpadxiitexpandR3tbothtbottom(RRtButtont_prev_montht_next_monthtLabelt_headertTreeviewRtpacktgrid(R%thframetlbtntrbtn((s4/usr/lib64/python2.7/Demo/tkinter/ttk/ttkcalendar.pyt__place_widgetsZs!"%c	s�|jjd�j�}||jd<|jjddd�|jjddd|d	d�tj��t�fd
�|D��}x0|D](}|jj	|d|d|d
d�q�WdS(NitcolumnstheaderR+tgrey90R
RRttagc3s|]}�j|�VqdS(N(tmeasure(t.0tcol(tfont(s4/usr/lib64/python2.7/Demo/tkinter/ttk/ttkcalendar.pys	<genexpr>qsRDtminwidthREte(
RtformatweekheadertsplitRt
tag_configureR ttkFonttFonttmaxRO(R%tcolstmaxwidthRg((Rhs4/usr/lib64/python2.7/Demo/tkinter/ttk/ttkcalendar.pyt__config_calendarjs

cs�tj�|_tj|jd|dddd�|_��jddd|dd��_�j	d�fd	��|jj	d
�fd��|jj	d|j
�dS(NR+tborderwidthithighlightthicknessR3REtws<ButtonPress-1>cs
�j�S(N(tplace_forget(tevt(tcanvas(s4/usr/lib64/python2.7/Demo/tkinter/ttk/ttkcalendar.pyR;|R
s<Configure>cs
�j�S(N(Rw(Rx(Ry(s4/usr/lib64/python2.7/Demo/tkinter/ttk/ttkcalendar.pyR;}R
(RnRot_fonttTkintertCanvasRR.tcreate_textR0R#t_pressed(R%R(R)((Rys4/usr/lib64/python2.7/Demo/tkinter/ttk/ttkcalendar.pyt__setup_selectionvs!cCsN|jjj�jd�\}}||jd� }|jjj||�dS(Ntxt+(RR&tgeometryRltindextminsize(R%RxRDRJ((s4/usr/lib64/python2.7/Demo/tkinter/ttk/ttkcalendar.pyt	__minsize�s!c
Cs�|jj|jj}}|jj||d�}|j�|jd<|jj||�}x~t|j	�D]m\}}|t
|�kr�||ng}g|D]}|r�d|nd^q�}	|jj|d|	�qiWdS(NiR0s%02dR
R(
RR	R
RtformatmonthnamettitleRYtmonthdayscalendart	enumerateR!tlenRR,(
R%R	R
RbtcaltindxR,tweektdaytfmt_week((s4/usr/lib64/python2.7/Demo/tkinter/ttk/ttkcalendar.pyR"�s")c	Cs�|\}}}}|jj|�}|j}|jd|d|�|j|j|||dd�|j|jd|�|jd|jd|d|�d	S(
s%Configure canvas for a new selection.RDRJiiR0RKR�tyN(	RzReR.t	configuretcoordsR0R/tplaceR(	R%R0tbboxR�R�RDRJttextwRy((s4/usr/lib64/python2.7/Demo/tkinter/ttk/ttkcalendar.pyt_show_selection�s	"c
Cs�|j|j|j}}}|j|�}|j|�}|sQ||jkrUdS|j|�d}t|�sxdS|t|d�d}|s�dS|j	||�}	|	s�dSd|}|||f|_
|j||	�dS(s"Clicked somewhere in the calendar.NRis%02d(R�R�twidgettidentify_rowtidentify_columnR!R,R�tintR�RR�(
R%RxR�R�R�R,ROtitem_valuesR0R�((s4/usr/lib64/python2.7/Demo/tkinter/ttk/ttkcalendar.pyR~�s"
cCs[|jj�|j|jdd�|_|j|jj|jjd�|_|j�dS(s,Updated calendar to show the previous month.tdaysiN(R.RwRt	timedeltaRR	R
R"(R%((s4/usr/lib64/python2.7/Demo/tkinter/ttk/ttkcalendar.pyRV�s
$cCs�|jj�|jj|jj}}|j|jdtj||�dd�|_|j|jj|jjd�|_|j	�dS(s'Update calendar to show the next month.R�iN(
R.RwRR	R
R�Rt
monthrangeRR"(R%R	R
((s4/usr/lib64/python2.7/Demo/tkinter/ttk/ttkcalendar.pyRW�s
!$cCsF|js
dS|jj|jj}}|j||t|jd��S(s9Return a datetime representing the current selected date.iN(RRRR	R
RR�(R%R	R
((s4/usr/lib64/python2.7/Demo/tkinter/ttk/ttkcalendar.pyt	selection�s	N(t__name__t
__module__RRR�RRR1R7RRRRR$R"R�R~RVRWtpropertyR�(((s4/usr/lib64/python2.7/Demo/tkinter/ttk/ttkcalendar.pyRs %	
						
						cCs�ddl}tj�}|jd�tdtj�}|jdddd�d|jkrxt	j
�}|jd	�n|j�dS(
Ni����sTtk CalendarRRRiR3RStwintclam(
tsysR{tTkR�RRtSUNDAYR[tplatformRR>t	theme_usetmainloop(R�troottttkcalR@((s4/usr/lib64/python2.7/Demo/tkinter/ttk/ttkcalendar.pyttest�s
t__main__(
t__doc__RR{RnRRRRR�R�(((s4/usr/lib64/python2.7/Demo/tkinter/ttk/ttkcalendar.pyt<module>s	�	
PK�
Q\y5�L��ttk/roundframe.pynu�[���"""Ttk Frame with rounded corners.

Based on an example by Bryan Oakley, found at: http://wiki.tcl.tk/20152"""
import Tkinter
import ttk

root = Tkinter.Tk()

img1 = Tkinter.PhotoImage("frameFocusBorder", data="""
R0lGODlhQABAAPcAAHx+fMTCxKSipOTi5JSSlNTS1LSytPTy9IyKjMzKzKyq
rOzq7JyanNza3Ly6vPz6/ISChMTGxKSmpOTm5JSWlNTW1LS2tPT29IyOjMzO
zKyurOzu7JyenNze3Ly+vPz+/OkAKOUA5IEAEnwAAACuQACUAAFBAAB+AFYd
QAC0AABBAAB+AIjMAuEEABINAAAAAHMgAQAAAAAAAAAAAKjSxOIEJBIIpQAA
sRgBMO4AAJAAAHwCAHAAAAUAAJEAAHwAAP+eEP8CZ/8Aif8AAG0BDAUAAJEA
AHwAAIXYAOfxAIESAHwAAABAMQAbMBZGMAAAIEggJQMAIAAAAAAAfqgaXESI
5BdBEgB+AGgALGEAABYAAAAAAACsNwAEAAAMLwAAAH61MQBIAABCM8B+AAAU
AAAAAAAApQAAsf8Brv8AlP8AQf8Afv8AzP8A1P8AQf8AfgAArAAABAAADAAA
AACQDADjAAASAAAAAACAAADVABZBAAB+ALjMwOIEhxINUAAAANIgAOYAAIEA
AHwAAGjSAGEEABYIAAAAAEoBB+MAAIEAAHwCACABAJsAAFAAAAAAAGjJAGGL
AAFBFgB+AGmIAAAQAABHAAB+APQoAOE/ABIAAAAAAADQAADjAAASAAAAAPiF
APcrABKDAAB8ABgAGO4AAJAAqXwAAHAAAAUAAJEAAHwAAP8AAP8AAP8AAP8A
AG0pIwW3AJGSAHx8AEocI/QAAICpAHwAAAA0SABk6xaDEgB8AAD//wD//wD/
/wD//2gAAGEAABYAAAAAAAC0/AHj5AASEgAAAAA01gBkWACDTAB8AFf43PT3
5IASEnwAAOAYd+PuMBKQTwB8AGgAEGG35RaSEgB8AOj/NOL/ZBL/gwD/fMkc
q4sA5UGpEn4AAIg02xBk/0eD/358fx/4iADk5QASEgAAAALnHABkAACDqQB8
AMyINARkZA2DgwB8fBABHL0AAEUAqQAAAIAxKOMAPxIwAAAAAIScAOPxABIS
AAAAAIIAnQwA/0IAR3cAACwAAAAAQABAAAAI/wA/CBxIsKDBgwgTKlzIsKFD
gxceNnxAsaLFixgzUrzAsWPFCw8kDgy5EeQDkBxPolypsmXKlx1hXnS48UEH
CwooMCDAgIJOCjx99gz6k+jQnkWR9lRgYYDJkAk/DlAgIMICZlizat3KtatX
rAsiCNDgtCJClQkoFMgqsu3ArBkoZDgA8uDJAwk4bGDmtm9BZgcYzK078m4D
Cgf4+l0skNkGCg3oUhR4d4GCDIoZM2ZWQMECyZQvLMggIbPmzQIyfCZ5YcME
AwFMn/bLLIKBCRtMHljQQcDV2ZqZTRDQYfWFAwMqUJANvC8zBhUWbDi5YUAB
Bsybt2VGoUKH3AcmdP+Im127xOcJih+oXsEDdvOLuQfIMGBD9QwBlsOnzcBD
hfrsuVfefgzJR599A+CnH4Hb9fcfgu29x6BIBgKYYH4DTojQc/5ZGGGGGhpU
IYIKghgiQRw+GKCEJxZIwXwWlthiQyl6KOCMLsJIIoY4LlQjhDf2mNCI9/Eo
5IYO2sjikX+9eGCRCzL5V5JALillY07GaOSVb1G5ookzEnlhlFx+8OOXZb6V
5Y5kcnlmckGmKaaMaZrpJZxWXjnnlmW++WGdZq5ZXQEetKmnlxPgl6eUYhJq
KKOI0imnoNbF2ScFHQJJwW99TsBAAAVYWEAAHEQAZoi1cQDqAAeEV0EACpT/
JqcACgRQAW6uNWCbYKcyyEwGDBgQwa2tTlBBAhYIQMFejC5AgQAWJNDABK3y
loEDEjCgV6/aOcYBAwp4kIF6rVkXgAEc8IQZVifCBRQHGqya23HGIpsTBgSU
OsFX/PbrVVjpYsCABA4kQCxHu11ogAQUIOAwATpBLDFQFE9sccUYS0wAxD5h
4DACFEggbAHk3jVBA/gtTIHHEADg8sswxyzzzDQDAAEECGAQsgHiTisZResN
gLIHBijwLQEYePzx0kw37fTSSjuMr7ZMzfcgYZUZi58DGsTKwbdgayt22GSP
bXbYY3MggQIaONDzAJ8R9kFlQheQQAAOWGCAARrwdt23Bn8H7vfggBMueOEG
WOBBAAkU0EB9oBGUdXIFZJBABAEEsPjmmnfO+eeeh/55BBEk0Ph/E8Q9meQq
bbDABAN00EADFRRQ++2254777rr3jrvjFTTQwQCpz7u6QRut5/oEzA/g/PPQ
Ry/99NIz//oGrZpUUEAAOw==""")

img2 = Tkinter.PhotoImage("frameBorder", data="""
R0lGODlhQABAAPcAAHx+fMTCxKSipOTi5JSSlNTS1LSytPTy9IyKjMzKzKyq
rOzq7JyanNza3Ly6vPz6/ISChMTGxKSmpOTm5JSWlNTW1LS2tPT29IyOjMzO
zKyurOzu7JyenNze3Ly+vPz+/OkAKOUA5IEAEnwAAACuQACUAAFBAAB+AFYd
QAC0AABBAAB+AIjMAuEEABINAAAAAHMgAQAAAAAAAAAAAKjSxOIEJBIIpQAA
sRgBMO4AAJAAAHwCAHAAAAUAAJEAAHwAAP+eEP8CZ/8Aif8AAG0BDAUAAJEA
AHwAAIXYAOfxAIESAHwAAABAMQAbMBZGMAAAIEggJQMAIAAAAAAAfqgaXESI
5BdBEgB+AGgALGEAABYAAAAAAACsNwAEAAAMLwAAAH61MQBIAABCM8B+AAAU
AAAAAAAApQAAsf8Brv8AlP8AQf8Afv8AzP8A1P8AQf8AfgAArAAABAAADAAA
AACQDADjAAASAAAAAACAAADVABZBAAB+ALjMwOIEhxINUAAAANIgAOYAAIEA
AHwAAGjSAGEEABYIAAAAAEoBB+MAAIEAAHwCACABAJsAAFAAAAAAAGjJAGGL
AAFBFgB+AGmIAAAQAABHAAB+APQoAOE/ABIAAAAAAADQAADjAAASAAAAAPiF
APcrABKDAAB8ABgAGO4AAJAAqXwAAHAAAAUAAJEAAHwAAP8AAP8AAP8AAP8A
AG0pIwW3AJGSAHx8AEocI/QAAICpAHwAAAA0SABk6xaDEgB8AAD//wD//wD/
/wD//2gAAGEAABYAAAAAAAC0/AHj5AASEgAAAAA01gBkWACDTAB8AFf43PT3
5IASEnwAAOAYd+PuMBKQTwB8AGgAEGG35RaSEgB8AOj/NOL/ZBL/gwD/fMkc
q4sA5UGpEn4AAIg02xBk/0eD/358fx/4iADk5QASEgAAAALnHABkAACDqQB8
AMyINARkZA2DgwB8fBABHL0AAEUAqQAAAIAxKOMAPxIwAAAAAIScAOPxABIS
AAAAAIIAnQwA/0IAR3cAACwAAAAAQABAAAAI/wA/CBxIsKDBgwgTKlzIsKFD
gxceNnxAsaLFixgzUrzAsWPFCw8kDgy5EeQDkBxPolypsmXKlx1hXnS48UEH
CwooMCDAgIJOCjx99gz6k+jQnkWR9lRgYYDJkAk/DlAgIMICkVgHLoggQIPT
ighVJqBQIKvZghkoZDgA8uDJAwk4bDhLd+ABBmvbjnzbgMKBuoA/bKDQgC1F
gW8XKMgQOHABBQsMI76wIIOExo0FZIhM8sKGCQYCYA4cwcCEDSYPLOgg4Oro
uhMEdOB84cCAChReB2ZQYcGGkxsGFGCgGzCFCh1QH5jQIW3xugwSzD4QvIIH
4s/PUgiQYcCG4BkC5P/ObpaBhwreq18nb3Z79+8Dwo9nL9I8evjWsdOX6D59
fPH71Xeef/kFyB93/sln4EP2Ebjegg31B5+CEDLUIH4PVqiQhOABqKFCF6qn
34cHcfjffCQaFOJtGaZYkIkUuljQigXK+CKCE3po40A0trgjjDru+EGPI/6I
Y4co7kikkAMBmaSNSzL5gZNSDjkghkXaaGIBHjwpY4gThJeljFt2WSWYMQpZ
5pguUnClehS4tuMEDARQgH8FBMBBBExGwIGdAxywXAUBKHCZkAIoEEAFp33W
QGl47ZgBAwZEwKigE1SQgAUCUDCXiwtQIIAFCTQwgaCrZeCABAzIleIGHDD/
oIAHGUznmXABGMABT4xpmBYBHGgAKGq1ZbppThgAG8EEAW61KwYMSOBAApdy
pNp/BkhAAQLcEqCTt+ACJW645I5rLrgEeOsTBtwiQIEElRZg61sTNBBethSw
CwEA/Pbr778ABywwABBAgAAG7xpAq6mGUUTdAPZ6YIACsRKAAbvtZqzxxhxn
jDG3ybbKFHf36ZVYpuE5oIGhHMTqcqswvyxzzDS/HDMHEiiggQMLDxCZXh8k
BnEBCQTggAUGGKCB0ktr0PTTTEfttNRQT22ABR4EkEABDXgnGUEn31ZABglE
EEAAWaeN9tpqt832221HEEECW6M3wc+Hga3SBgtMODBABw00UEEBgxdO+OGG
J4744oZzXUEDHQxwN7F5G7QRdXxPoPkAnHfu+eeghw665n1vIKhJBQUEADs=""")

style = ttk.Style()

style.element_create("RoundedFrame", "image", "frameBorder",
    ("focus", "frameFocusBorder"), border=16, sticky="nsew")

style.layout("RoundedFrame", [("RoundedFrame", {"sticky": "nsew"})])
style.configure("TEntry", borderwidth=0)

frame = ttk.Frame(style="RoundedFrame", padding=10)
frame.pack(fill='x')

frame2 = ttk.Frame(style="RoundedFrame", padding=10)
frame2.pack(fill='both', expand=1)

entry = ttk.Entry(frame, text='Test')
entry.pack(fill='x')
entry.bind("<FocusIn>", lambda evt: frame.state(["focus"]))
entry.bind("<FocusOut>", lambda evt: frame.state(["!focus"]))

text = Tkinter.Text(frame2, borderwidth=0, bg="white", highlightthickness=0)
text.pack(fill='both', expand=1)
text.bind("<FocusIn>", lambda evt: frame2.state(["focus"]))
text.bind("<FocusOut>", lambda evt: frame2.state(["!focus"]))

root.mainloop()
PK�
Q\�/
QQttk/combo_themes.pynu�[���"""Ttk Theme Selector.

Although it is a theme selector, you won't notice many changes since
there is only a combobox and a frame around.
"""
import ttk

class App(ttk.Frame):
    def __init__(self):
        ttk.Frame.__init__(self)

        self.style = ttk.Style()
        self._setup_widgets()

    def _change_theme(self, event):
        if event.widget.current(): # value #0 is not a theme
            newtheme = event.widget.get()
            # change to the new theme and refresh all the widgets
            self.style.theme_use(newtheme)

    def _setup_widgets(self):
        themes = list(self.style.theme_names())
        themes.insert(0, "Pick a theme")
        # Create a readonly Combobox which will display 4 values at max,
        # which will cause it to create a scrollbar if there are more
        # than 4 values in total.
        themes_combo = ttk.Combobox(self, values=themes, state="readonly",
                                    height=4)
        themes_combo.set(themes[0]) # sets the combobox value to "Pick a theme"
        # Combobox widget generates a <<ComboboxSelected>> virtual event
        # when the user selects an element. This event is generated after
        # the listbox is unposted (after you select an item, the combobox's
        # listbox disappears, then it is said that listbox is now unposted).
        themes_combo.bind("<<ComboboxSelected>>", self._change_theme)
        themes_combo.pack(fill='x')

        self.pack(fill='both', expand=1)


def main():
    app = App()
    app.master.title("Ttk Combobox")
    app.mainloop()

if __name__ == "__main__":
    main()
PK�
Q\#��ggttk/treeview_multicolumn.pyonu�[����
��^c@s�dZddlZddlZddlZd6Zd7d8d9d:d;d<d=d>d?d@dAdBdCdDdEgZd1�Zd2efd3��YZd4�Z	e
d5kr�e	�ndS(FsCDemo based on the demo mclist included with tk source distribution.i����Ntcountrytcapitaltcurrencyt	ArgentinasBuenos AirestARSt	AustraliatCanberratAUDtBraziltBraziliatBRLtCanadatOttawatCADtChinatBeijingtCNYtFrancetParistEURtGermanytBerlintIndias	New DelhitINRtItalytRometJapantTokyotJPYtMexicosMexico CitytMXNtRussiatMoscowtRUBsSouth AfricatPretoriatZARsUnited KingdomtLondontGBPs
United StatessWashington, D.C.tUSDcs�g�jd�D]}�j||�|f^q}|jd��x1t|�D]#\}}�j|dd|�qQW�j|d|��fd��dS(s/Sort tree contents when a column is clicked on.ttreverseitcommandcst�|t���S(N(tsortbytint(tcol(t
descendingttree(s=/usr/lib64/python2.7/Demo/tkinter/ttk/treeview_multicolumn.pyt<lambda>%R'N(tget_childrentsettsortt	enumeratetmovetheading(R.R,R-tchildtdatatindxtitem((R-R.s=/usr/lib64/python2.7/Demo/tkinter/ttk/treeview_multicolumn.pyR*s4tAppcBs#eZd�Zd�Zd�ZRS(cCs!d|_|j�|j�dS(N(tNoneR.t_setup_widgetst_build_tree(tself((s=/usr/lib64/python2.7/Demo/tkinter/ttk/treeview_multicolumn.pyt__init__(s	
cCsetjdddddddd$dd�}|jd
d�tj�}|jd
ddt�tjdtdd�|_tjddd|jj	�}tjddd|jj
�}|jjd|jd|j�|jj
ddddddd|�|j
dd dddd!d|�|j
dddd dd"d|�|jdd#d �|jdd#d �dS(%Nt
wraplengtht4itjustifytlefttanchortntpaddingi
iittexts�Ttk is the new Tk themed widget set. One of the widgets it includes is a tree widget, which can be configured to display multiple columns of informational data without displaying the tree itself. This is a simple way to build a listbox that has multiple columns. Clicking on the heading for a column will sort the data by that column. You can also change the width of the columns by dragging the boundary between them.tfilltxtbothtexpandtcolumnstshowtheadingstorienttverticalR)t
horizontaltyscrollcommandtxscrollcommandtcolumnitrowtstickytnsewtin_itnstewtweight(i
ii
i(tttktLabeltpacktFrametTruetTreeviewttree_columnsR.t	Scrollbartyviewtxviewt	configureR1tgridtgrid_columnconfiguretgrid_rowconfigure(R>tmsgt	containertvsbthsb((s=/usr/lib64/python2.7/Demo/tkinter/ttk/treeview_multicolumn.pyR<-s	%""c	s	xgtD]_}�jj|d|j�d|�fd���jj|dtj�j|j���qWx�tD]�}�jj	ddd|�xnt
|�D]`\}}tj�j|�}�jjt|dd�|kr��jjt|d|�q�q�WqqWdS(NRGR)cst�j|d�S(Ni(R*R.(tc(R>(s=/usr/lib64/python2.7/Demo/tkinter/ttk/treeview_multicolumn.pyR/MR'twidthR'tendtvalues(RbR.R5ttitleRTttkFonttFonttmeasuret	tree_datatinsertR3R;(R>R,R9R8tvaltilen((R>s=/usr/lib64/python2.7/Demo/tkinter/ttk/treeview_multicolumn.pyR=Js
/
"(t__name__t
__module__R?R<R=(((s=/usr/lib64/python2.7/Demo/tkinter/ttk/treeview_multicolumn.pyR:'s		cCs�tj�}|jd�|jd�ddl}y|jd�Wn*tk
roddl}|jd�nXt	�}|j
�dS(NsMulti-Column Listtmclisti����s~/tile-themes/plastik/plastiks'plastik theme being used without images(tTkintertTktwm_titletwm_iconnamet
plastik_themetinstallt	ExceptiontwarningstwarnR:tmainloop(trootR�R�tapp((s=/usr/lib64/python2.7/Demo/tkinter/ttk/treeview_multicolumn.pytmain[s


	t__main__(RRR(RsBuenos AiresR(RRR(RR	R
(RRR
(RRR(RRR(RRR(Rs	New DelhiR(RRR(RRR(RsMexico CityR(RR R!(sSouth AfricaR"R#(sUnited KingdomR$R%(s
United StatessWashington, D.C.R&(t__doc__R}RsR\RbRvR*tobjectR:R�Rz(((s=/usr/lib64/python2.7/Demo/tkinter/ttk/treeview_multicolumn.pyt<module>s0		4	PK�
Q\|&C]��ttk/combo_themes.pycnu�[����
��^c@sNdZddlZdejfd��YZd�ZedkrJe�ndS(s�Ttk Theme Selector.

Although it is a theme selector, you won't notice many changes since
there is only a combobox and a frame around.
i����NtAppcBs#eZd�Zd�Zd�ZRS(cCs-tjj|�tj�|_|j�dS(N(tttktFramet__init__tStyletstylet_setup_widgets(tself((s5/usr/lib64/python2.7/Demo/tkinter/ttk/combo_themes.pyR	scCs5|jj�r1|jj�}|jj|�ndS(N(twidgettcurrenttgetRt	theme_use(Rteventtnewtheme((s5/usr/lib64/python2.7/Demo/tkinter/ttk/combo_themes.pyt
_change_themescCs�t|jj��}|jdd�tj|d|dddd�}|j|d�|jd|j�|j	d	d
�|j	d	ddd
�dS(NisPick a themetvalueststatetreadonlytheightis<<ComboboxSelected>>tfilltxtbothtexpandi(
tlistRttheme_namestinsertRtComboboxtsettbindRtpack(Rtthemestthemes_combo((s5/usr/lib64/python2.7/Demo/tkinter/ttk/combo_themes.pyRs	(t__name__t
__module__RRR(((s5/usr/lib64/python2.7/Demo/tkinter/ttk/combo_themes.pyRs		cCs't�}|jjd�|j�dS(NsTtk Combobox(Rtmasterttitletmainloop(tapp((s5/usr/lib64/python2.7/Demo/tkinter/ttk/combo_themes.pytmain(s	t__main__(t__doc__RRRR&R (((s5/usr/lib64/python2.7/Demo/tkinter/ttk/combo_themes.pyt<module>s
 	PK�
Q\|&C]��ttk/combo_themes.pyonu�[����
��^c@sNdZddlZdejfd��YZd�ZedkrJe�ndS(s�Ttk Theme Selector.

Although it is a theme selector, you won't notice many changes since
there is only a combobox and a frame around.
i����NtAppcBs#eZd�Zd�Zd�ZRS(cCs-tjj|�tj�|_|j�dS(N(tttktFramet__init__tStyletstylet_setup_widgets(tself((s5/usr/lib64/python2.7/Demo/tkinter/ttk/combo_themes.pyR	scCs5|jj�r1|jj�}|jj|�ndS(N(twidgettcurrenttgetRt	theme_use(Rteventtnewtheme((s5/usr/lib64/python2.7/Demo/tkinter/ttk/combo_themes.pyt
_change_themescCs�t|jj��}|jdd�tj|d|dddd�}|j|d�|jd|j�|j	d	d
�|j	d	ddd
�dS(NisPick a themetvalueststatetreadonlytheightis<<ComboboxSelected>>tfilltxtbothtexpandi(
tlistRttheme_namestinsertRtComboboxtsettbindRtpack(Rtthemestthemes_combo((s5/usr/lib64/python2.7/Demo/tkinter/ttk/combo_themes.pyRs	(t__name__t
__module__RRR(((s5/usr/lib64/python2.7/Demo/tkinter/ttk/combo_themes.pyRs		cCs't�}|jjd�|j�dS(NsTtk Combobox(Rtmasterttitletmainloop(tapp((s5/usr/lib64/python2.7/Demo/tkinter/ttk/combo_themes.pytmain(s	t__main__(t__doc__RRRR&R (((s5/usr/lib64/python2.7/Demo/tkinter/ttk/combo_themes.pyt<module>s
 	PK�
Q\�J"_��ttk/notebook_closebtn.pycnu�[����
��^c
@s�dZddlZddlZddlZej�Zejjejje	�d�Z
ejddejje
d��Zejddejje
d��Z
ejd	dejje
d
��Zej�Zejdddd8d9dddd�ejddidd6fg�ejddidd6didd6dd6didd6dd6didd6dd6fdidd6dd6fgd 6fgd 6fgd 6fg�d!�Zd"�Zejd#d$ee�ejd#d%e�ejd&d'd(d'd)d�Zde_ejed*d+�Zejed*d,�Zejed*d-�Zejed.d/d0d1�ejed.d2d0d1�ejed.d3d0d1�ej d4d5d6d7�ej!�dS(:saA Ttk Notebook with close buttons.

Based on an example by patthoyts, http://paste.tclers.tk/896
i����Ntimgt	img_closetfiles	close.giftimg_closeactivesclose_active.giftimg_closepressedsclose_pressed.giftclosetimagetactivetpresseds	!disabledtborderitstickyttButtonNotebooksButtonNotebook.clienttnswesButtonNotebook.TabsButtonNotebook.tabsButtonNotebook.paddingttoptsidesButtonNotebook.focussButtonNotebook.labeltleftsButtonNotebook.closetchildrencCst|j|j|j}}}|j||�}|jd||f�}d|krp|jdg�||_ndS(Ns@%d,%dRR(txtytwidgettidentifytindextstatet
pressed_index(teventRRRtelemR((s:/usr/lib64/python2.7/Demo/tkinter/ttk/notebook_closebtn.pyt	btn_press&scCs�|j|j|j}}}|jdg�s3dS|j||�}|jd||f�}d|kr�|j|kr�|j|�|jd�n|j	dg�d|_dS(NRs@%d,%dRs<<NotebookClosedTab>>s!pressed(RRRtinstateRRRtforgettevent_generateRtNone(RRRRRR((s:/usr/lib64/python2.7/Demo/tkinter/ttk/notebook_closebtn.pytbtn_release/s
t	TNotebooks<ButtonPress-1>s<ButtonRelease-1>twidthi�theighttstylet
backgroundtredtgreentbluettexttRedtpaddingitGreentBluetexpanditfilltboth(RRs	!disabledR(Rs	!disabledR("t__doc__tostTkintertttktTktroottpathtjointdirnamet__file__timgdirt
PhotoImageti1ti2ti3tStyleR$telement_createtlayoutRR t
bind_classtTruetNotebooktnbRRtFrametf1tf2tf3taddtpacktmainloop(((s:/usr/lib64/python2.7/Demo/tkinter/ttk/notebook_closebtn.pyt<module>sF!$ 	
<				PK�
Q\>���ttk/mac_searchentry.pyonu�[����
��^c
@sdZddlZddlZej�ZdZejddedd�Zejddedd	�Zej	�Z
e
jd
ddd!d
dddgdd�e
jdd
idd6dd
6didd6didd6fgd6fgd6fg�e
j
ddd�ej
dd�ejdddd�Zejdddd�Zejddd d�ejddd d�ej�dS("s\Mac style search widget

Translated from Tcl code by Schelte Bron, http://wiki.tcl.tk/18188
i����Ns�

R0lGODlhKgAaAOfnAFdZVllbWFpcWVtdWlxeW11fXF9hXmBiX2ZnZWhpZ2lraGxua25wbXJ0
cXR2c3V3dHZ4dXh6d3x+e31/fH6AfYSGg4eJhoiKh4qMiYuNio2PjHmUqnqVq3yXrZGTkJKU
kX+asJSWk32cuJWXlIGcs5aYlX6euZeZloOetZial4SftpqbmIWgt4GhvYahuIKivpudmYei
uYOjv5yem4ijuoSkwIWlwYmlu56gnYamwp+hnoenw4unvaCin4ioxJCnuZykrImpxZmlsoaq
zI2pv6KkoZGouoqqxpqms4erzaOloo6qwYurx5Kqu5untIiszqSmo5CrwoysyJeqtpOrvJyo
tZGsw42typSsvaaopZKtxJWtvp6qt4+uy6epppOuxZCvzKiqp5quuZSvxoyx06mrqJWwx42y
1JKxzpmwwaqsqZaxyI6z1ZqxwqutqpOzz4+01qyuq56yvpizypS00Jm0y5W10Zq1zJa20rCy
rpu3zqizwbGzr6C3yZy4z7K0saG4yp250LO1sqK5y5660Z+70qO7zKy4xaC806S8zba4taG9
1KW9zq66x6+7yLi6t6S/1rC8yrm7uLO8xLG9y7q8ubS9xabB2anB07K+zLW+xrO/za7CzrTA
zrjAyLXBz77BvbbC0K/G2LjD0bnE0rLK28TGw8bIxcLL07vP28HN28rMycvOyr/T38DU4cnR
2s/RztHT0NLU0cTY5MrW5MvX5dHX2c3Z59bY1dPb5Nbb3dLe7Nvd2t3f3NXh797g3d3j5dnl
9OPl4eTm4+Ln6tzo9uXn5Obo5eDp8efp5uHq8uXq7ejq5+nr6OPs9Ovu6unu8O3v6+vw8+7w
7ezx9O/x7vDy7/Hz8O/19/P18vT38/L3+fb49Pf59vX6/fj69/b7/vn7+Pr8+ff9//v9+vz/
+/7//P//////////////////////////////////////////////////////////////////
/////////////////////////////////yH/C05FVFNDQVBFMi4wAwEAAAAh+QQJZAD/ACwC
AAIAKAAWAAAI/gD/CRz4bwUGCg8eQFjIsGHDBw4iTLAQgqBFgisuePCiyJOpUyBDihRpypMi
Lx8qaLhIMIyGFZ5sAUsmjZrNmzhzWpO2DJgtTysqfGDpxoMbW8ekeQsXzty4p1CjRjUXrps3
asJsuclQ4uKKSbamMR3n1JzZs2jRkh1HzuxVXX8y4CDYAwqua+DInVrRwMGJU2kDp31KThy1
XGWGDlxhi1rTPAUICBBAoEAesoIzn6Vm68MKgVAUHftmzhOCBCtQwQKSoABgzZnJdSMmyIPA
FbCotdUQAIhNa9B6DPCAGbZac+SowVIMRVe4pwkA4GpqDlwuAAmMZx4nTtfnf1mO5JEDNy46
MHJkxQEDgKC49rPjwC0bqGaZuOoZAKjBPE4NgAzUvYcWOc0QZF91imAnCDHJ5JFAAJN0I2Ba
4iRDUC/gOEVNDwIUcEABCAgAAATUTIgWOMBYRFp80ghiAQIIVAAEAwJIYI2JZnUji0XSYAYO
NcsQA8wy0hCTwAASXGOiONFcxAtpTokTHznfiLMNMAkcAMuE43jDC0vLeGOWe2R5o4sn1LgH
GzkWsvTPMgEOaA433Ag4TjjMuDkQMNi0tZ12sqWoJ0HATMPNffAZZ6U0wLAyqJ62RGoLLrhI
aqmlpzwaEAAh+QQJZAD/ACwAAAAAKgAaAAAI/gD/CRw40JEhQoEC+fGjcOHCMRAjRkxDsKLF
f5YcAcID582ZjyBDJhmZZIjJIUySEDHiBMhFghrtdNnRAgSHmzhz6sTZQcSLITx+CHn5bxSk
Nz5MCMGy55CjTVCjbuJEtSrVQ3uwqDBRQwrFi476SHHxow8qXcemVbPGtm21t3CnTaP27Jgu
VHtuiIjBsuImQkRiiEEFTNo2cOTMKV7MuLE5cN68QUOGSgwKG1EqJqJDY8+rZt8UjxtNunTj
cY3DgZOWS46KIFgGjiI0ZIsqaqNNjWjgYMUpx8Adc3v2aosNMAI1DbqyI9WycOb4IAggQEAB
A3lQBxet/TG4cMpI/tHwYeSfIzxM0uTKNs7UgAQrYL1akaDA7+3bueVqY4NJlUhIcQLNYx8E
AIQ01mwjTQ8DeNAdfouNA8440GBCQxJY3MEGD6p4Y844CQCAizcSgpMLAAlAuJ03qOyQRBR3
nEHEK+BMGKIui4kDDAAIPKiiYuSYSMQQRCDCxhiziPMYBgDkEaEaAGQA3Y+MjUPOLFoMoUUh
cKxRC4ngeILiH8Qkk0cCAUzSDZWpzbLEE1EwggcYqWCj2DNADFDAAQUgIAAAEFDDJmPYqNJF
F1s4cscTmCDjDTjdSPOHBQggUAEQDAgggTWDPoYMJkFoUdRmddyyjWLeULMMMcAsIw0x4wkM
IME1g25zyxpHxFYUHmyIggw4H4ojITnfiLMNMAkcAAub4BQjihRdDGTJHmvc4Qo1wD6Imje6
eILbj+BQ4wqu5Q3ECSJ0FOKKMtv4mBg33Pw4zjbKuBIIE1xYpIkhdQQiyi7OtAucj6dt48wu
otQhBRa6VvSJIRwhIkotvgRTzMUYZ6xxMcj4QkspeKDxxRhEmUfIHWjAgQcijEDissuXvCyz
zH7Q8YQURxDhUsn/bCInR3AELfTQZBRt9BBJkCGFFVhMwTNBlnBCSCGEIJQQIAklZMXWRBAR
RRRWENHwRQEBADs=tsearch1tdatatformatsgif -index 0tsearch2sgif -index 1sSearch.fieldtimagetfocustborderiiitstickytewsSearch.entrytnsweis
Entry.paddingsEntry.textareatchildrent
backgrounds#b2b2b2tstyletwidthitpadxi
tpady(RR(t__doc__tTkintertttktTktrootRt
PhotoImagets1ts2tStyleRtelement_createtlayoutt	configuretEntryte1te2tgridtmainloop(((s8/usr/lib64/python2.7/Demo/tkinter/ttk/mac_searchentry.pyt<module>s()	
+PK�
Q\>���ttk/mac_searchentry.pycnu�[����
��^c
@sdZddlZddlZej�ZdZejddedd�Zejddedd	�Zej	�Z
e
jd
ddd!d
dddgdd�e
jdd
idd6dd
6didd6didd6fgd6fgd6fg�e
j
ddd�ej
dd�ejdddd�Zejdddd�Zejddd d�ejddd d�ej�dS("s\Mac style search widget

Translated from Tcl code by Schelte Bron, http://wiki.tcl.tk/18188
i����Ns�

R0lGODlhKgAaAOfnAFdZVllbWFpcWVtdWlxeW11fXF9hXmBiX2ZnZWhpZ2lraGxua25wbXJ0
cXR2c3V3dHZ4dXh6d3x+e31/fH6AfYSGg4eJhoiKh4qMiYuNio2PjHmUqnqVq3yXrZGTkJKU
kX+asJSWk32cuJWXlIGcs5aYlX6euZeZloOetZial4SftpqbmIWgt4GhvYahuIKivpudmYei
uYOjv5yem4ijuoSkwIWlwYmlu56gnYamwp+hnoenw4unvaCin4ioxJCnuZykrImpxZmlsoaq
zI2pv6KkoZGouoqqxpqms4erzaOloo6qwYurx5Kqu5untIiszqSmo5CrwoysyJeqtpOrvJyo
tZGsw42typSsvaaopZKtxJWtvp6qt4+uy6epppOuxZCvzKiqp5quuZSvxoyx06mrqJWwx42y
1JKxzpmwwaqsqZaxyI6z1ZqxwqutqpOzz4+01qyuq56yvpizypS00Jm0y5W10Zq1zJa20rCy
rpu3zqizwbGzr6C3yZy4z7K0saG4yp250LO1sqK5y5660Z+70qO7zKy4xaC806S8zba4taG9
1KW9zq66x6+7yLi6t6S/1rC8yrm7uLO8xLG9y7q8ubS9xabB2anB07K+zLW+xrO/za7CzrTA
zrjAyLXBz77BvbbC0K/G2LjD0bnE0rLK28TGw8bIxcLL07vP28HN28rMycvOyr/T38DU4cnR
2s/RztHT0NLU0cTY5MrW5MvX5dHX2c3Z59bY1dPb5Nbb3dLe7Nvd2t3f3NXh797g3d3j5dnl
9OPl4eTm4+Ln6tzo9uXn5Obo5eDp8efp5uHq8uXq7ejq5+nr6OPs9Ovu6unu8O3v6+vw8+7w
7ezx9O/x7vDy7/Hz8O/19/P18vT38/L3+fb49Pf59vX6/fj69/b7/vn7+Pr8+ff9//v9+vz/
+/7//P//////////////////////////////////////////////////////////////////
/////////////////////////////////yH/C05FVFNDQVBFMi4wAwEAAAAh+QQJZAD/ACwC
AAIAKAAWAAAI/gD/CRz4bwUGCg8eQFjIsGHDBw4iTLAQgqBFgisuePCiyJOpUyBDihRpypMi
Lx8qaLhIMIyGFZ5sAUsmjZrNmzhzWpO2DJgtTysqfGDpxoMbW8ekeQsXzty4p1CjRjUXrps3
asJsuclQ4uKKSbamMR3n1JzZs2jRkh1HzuxVXX8y4CDYAwqua+DInVrRwMGJU2kDp31KThy1
XGWGDlxhi1rTPAUICBBAoEAesoIzn6Vm68MKgVAUHftmzhOCBCtQwQKSoABgzZnJdSMmyIPA
FbCotdUQAIhNa9B6DPCAGbZac+SowVIMRVe4pwkA4GpqDlwuAAmMZx4nTtfnf1mO5JEDNy46
MHJkxQEDgKC49rPjwC0bqGaZuOoZAKjBPE4NgAzUvYcWOc0QZF91imAnCDHJ5JFAAJN0I2Ba
4iRDUC/gOEVNDwIUcEABCAgAAATUTIgWOMBYRFp80ghiAQIIVAAEAwJIYI2JZnUji0XSYAYO
NcsQA8wy0hCTwAASXGOiONFcxAtpTokTHznfiLMNMAkcAMuE43jDC0vLeGOWe2R5o4sn1LgH
GzkWsvTPMgEOaA433Ag4TjjMuDkQMNi0tZ12sqWoJ0HATMPNffAZZ6U0wLAyqJ62RGoLLrhI
aqmlpzwaEAAh+QQJZAD/ACwAAAAAKgAaAAAI/gD/CRw40JEhQoEC+fGjcOHCMRAjRkxDsKLF
f5YcAcID582ZjyBDJhmZZIjJIUySEDHiBMhFghrtdNnRAgSHmzhz6sTZQcSLITx+CHn5bxSk
Nz5MCMGy55CjTVCjbuJEtSrVQ3uwqDBRQwrFi476SHHxow8qXcemVbPGtm21t3CnTaP27Jgu
VHtuiIjBsuImQkRiiEEFTNo2cOTMKV7MuLE5cN68QUOGSgwKG1EqJqJDY8+rZt8UjxtNunTj
cY3DgZOWS46KIFgGjiI0ZIsqaqNNjWjgYMUpx8Adc3v2aosNMAI1DbqyI9WycOb4IAggQEAB
A3lQBxet/TG4cMpI/tHwYeSfIzxM0uTKNs7UgAQrYL1akaDA7+3bueVqY4NJlUhIcQLNYx8E
AIQ01mwjTQ8DeNAdfouNA8440GBCQxJY3MEGD6p4Y844CQCAizcSgpMLAAlAuJ03qOyQRBR3
nEHEK+BMGKIui4kDDAAIPKiiYuSYSMQQRCDCxhiziPMYBgDkEaEaAGQA3Y+MjUPOLFoMoUUh
cKxRC4ngeILiH8Qkk0cCAUzSDZWpzbLEE1EwggcYqWCj2DNADFDAAQUgIAAAEFDDJmPYqNJF
F1s4cscTmCDjDTjdSPOHBQggUAEQDAgggTWDPoYMJkFoUdRmddyyjWLeULMMMcAsIw0x4wkM
IME1g25zyxpHxFYUHmyIggw4H4ojITnfiLMNMAkcAAub4BQjihRdDGTJHmvc4Qo1wD6Imje6
eILbj+BQ4wqu5Q3ECSJ0FOKKMtv4mBg33Pw4zjbKuBIIE1xYpIkhdQQiyi7OtAucj6dt48wu
otQhBRa6VvSJIRwhIkotvgRTzMUYZ6xxMcj4QkspeKDxxRhEmUfIHWjAgQcijEDissuXvCyz
zH7Q8YQURxDhUsn/bCInR3AELfTQZBRt9BBJkCGFFVhMwTNBlnBCSCGEIJQQIAklZMXWRBAR
RRRWENHwRQEBADs=tsearch1tdatatformatsgif -index 0tsearch2sgif -index 1sSearch.fieldtimagetfocustborderiiitstickytewsSearch.entrytnsweis
Entry.paddingsEntry.textareatchildrent
backgrounds#b2b2b2tstyletwidthitpadxi
tpady(RR(t__doc__tTkintertttktTktrootRt
PhotoImagets1ts2tStyleRtelement_createtlayoutt	configuretEntryte1te2tgridtmainloop(((s8/usr/lib64/python2.7/Demo/tkinter/ttk/mac_searchentry.pyt<module>s()	
+PK�
Q\��yTt%t%ttk/plastik_theme.pynu�[���"""This demonstrates good part of the syntax accepted by theme_create.

This is a translation of plastik.tcl to python.
You will need the images used by the plastik theme to test this. The
images (and other tile themes) can be retrived by doing:

$ cvs -z3 -d:pserver:anonymous@tktable.cvs.sourceforge.net:/cvsroot/tktable \
  co tile-themes

To test this module you should do, for example:

import Tkinter
import plastik_theme

root = Tkinter.Tk()
plastik_theme.install(plastik_image_dir)
...

Where plastik_image_dir contains the path to the images directory used by
the plastik theme, something like: tile-themes/plastik/plastik
"""
import os
import glob
import ttk
from Tkinter import PhotoImage

__all__ = ['install']

colors = {
    "frame": "#efefef",
    "disabledfg": "#aaaaaa",
    "selectbg": "#657a9e",
    "selectfg": "#ffffff"
    }

imgs = {}
def _load_imgs(imgdir):
    imgdir = os.path.expanduser(imgdir)
    if not os.path.isdir(imgdir):
        raise Exception("%r is not a directory, can't load images" % imgdir)
    for f in glob.glob("%s/*.gif" % imgdir):
        img = os.path.split(f)[1]
        name = img[:-4]
        imgs[name] = PhotoImage(name, file=f, format="gif89")

def install(imgdir):
    _load_imgs(imgdir)
    style = ttk.Style()
    style.theme_create("plastik", "default", settings={
        ".": {
            "configure":
                {"background": colors['frame'],
                 "troughcolor": colors['frame'],
                 "selectbackground": colors['selectbg'],
                 "selectforeground": colors['selectfg'],
                 "fieldbackground": colors['frame'],
                 "font": "TkDefaultFont",
                 "borderwidth": 1},
            "map": {"foreground": [("disabled", colors['disabledfg'])]}
        },

        "Vertical.TScrollbar": {"layout": [
            ("Vertical.Scrollbar.uparrow", {"side": "top", "sticky": ''}),
            ("Vertical.Scrollbar.downarrow", {"side": "bottom", "sticky": ''}),
            ("Vertical.Scrollbar.uparrow", {"side": "bottom", "sticky": ''}),
            ("Vertical.Scrollbar.trough", {"sticky": "ns", "children":
                [("Vertical.Scrollbar.thumb", {"expand": 1, "unit": 1,
                    "children": [("Vertical.Scrollbar.grip", {"sticky": ''})]
                })]
            })]
        },

        "Horizontal.TScrollbar": {"layout": [
            ("Horizontal.Scrollbar.leftarrow", {"side": "left", "sticky": ''}),
            ("Horizontal.Scrollbar.rightarrow",
                {"side": "right", "sticky": ''}),
            ("Horizontal.Scrollbar.leftarrow",
                {"side": "right", "sticky": ''}),
            ("Horizontal.Scrollbar.trough", {"sticky": "ew", "children":
                [("Horizontal.Scrollbar.thumb", {"expand": 1, "unit": 1,
                    "children": [("Horizontal.Scrollbar.grip", {"sticky": ''})]
                })]
            })]
        },

        "TButton": {
            "configure": {"width": 10, "anchor": "center"},
            "layout": [
                ("Button.button", {"children":
                    [("Button.focus", {"children":
                        [("Button.padding", {"children":
                            [("Button.label", {"side": "left", "expand": 1})]
                        })]
                    })]
                })
            ]
        },

        "Toolbutton": {
            "configure": {"anchor": "center"},
            "layout": [
                ("Toolbutton.border", {"children":
                    [("Toolbutton.button", {"children":
                        [("Toolbutton.padding", {"children":
                            [("Toolbutton.label", {"side":"left", "expand":1})]
                        })]
                    })]
                })
            ]
        },

        "TMenubutton": {"layout": [
            ("Menubutton.button", {"children":
                [("Menubutton.indicator", {"side": "right"}),
                 ("Menubutton.focus", {"children":
                    [("Menubutton.padding", {"children":
                        [("Menubutton.label", {"side": "left", "expand": 1})]
                    })]
                })]
            })]
        },

        "TNotebook": {"configure": {"tabmargins": [0, 2, 0, 0]}},
        "TNotebook.tab": {
            "configure": {"padding": [6, 2, 6, 2], "expand": [0, 0, 2]},
            "map": {"expand": [("selected", [1, 2, 4, 2])]}
        },
        "Treeview": {"configure": {"padding": 0}},

        # elements
        "Button.button": {"element create":
            ("image", 'button-n',
                ("pressed", 'button-p'), ("active", 'button-h'),
                {"border": [4, 10], "padding": 4, "sticky":"ewns"}
            )
        },

        "Toolbutton.button": {"element create":
            ("image", 'tbutton-n',
                ("selected", 'tbutton-p'), ("pressed", 'tbutton-p'),
                ("active", 'tbutton-h'),
                {"border": [4, 9], "padding": 3, "sticky": "news"}
            )
        },

        "Checkbutton.indicator": {"element create":
            ("image", 'check-nu',
                ('active', 'selected', 'check-hc'),
                ('pressed', 'selected', 'check-pc'),
                ('active', 'check-hu'),
                ("selected", 'check-nc'),
                {"sticky": ''}
            )
        },

        "Radiobutton.indicator": {"element create":
            ("image", 'radio-nu',
                ('active', 'selected', 'radio-hc'),
                ('pressed', 'selected', 'radio-pc'),
                ('active', 'radio-hu'), ('selected', 'radio-nc'),
                {"sticky": ''}
            )
        },

        "Horizontal.Scrollbar.thumb": {"element create":
            ("image", 'hsb-n', {"border": 3, "sticky": "ew"})
        },

        "Horizontal.Scrollbar.grip": {"element create": ("image", 'hsb-g')},
        "Horizontal.Scrollbar.trough": {"element create": ("image", 'hsb-t')},
        "Vertical.Scrollbar.thumb": {"element create":
            ("image", 'vsb-n', {"border": 3, "sticky": "ns"})
        },
        "Vertical.Scrollbar.grip": {"element create": ("image", 'vsb-g')},
        "Vertical.Scrollbar.trough": {"element create": ("image", 'vsb-t')},
        "Scrollbar.uparrow": {"element create":
            ("image", 'arrowup-n', ("pressed", 'arrowup-p'), {"sticky": ''})
        },
        "Scrollbar.downarrow": {"element create":
            ("image", 'arrowdown-n',
            ("pressed", 'arrowdown-p'), {'sticky': ''})
        },
        "Scrollbar.leftarrow": {"element create":
            ("image", 'arrowleft-n',
            ("pressed", 'arrowleft-p'), {'sticky': ''})
        },
        "Scrollbar.rightarrow": {"element create":
            ("image", 'arrowright-n', ("pressed", 'arrowright-p'),
            {'sticky': ''})
        },

        "Horizontal.Scale.slider": {"element create":
            ("image", 'hslider-n', {'sticky': ''})
        },
        "Horizontal.Scale.trough": {"element create":
            ("image", 'hslider-t', {'border': 1, 'padding': 0})
        },
        "Vertical.Scale.slider": {"element create":
            ("image", 'vslider-n', {'sticky': ''})
        },
        "Vertical.Scale.trough": {"element create":
            ("image", 'vslider-t', {'border': 1, 'padding': 0})
        },

        "Entry.field": {"element create":
            ("image", 'entry-n',
                ("focus", 'entry-f'),
                {'border': 2, 'padding': [3, 4], 'sticky': 'news'}
            )
        },

        "Labelframe.border": {"element create":
            ("image", 'border', {'border': 4, 'padding': 4, 'sticky': 'news'})
        },

        "Menubutton.button": {"element create":
            ("image", 'combo-r',
                ('active', 'combo-ra'),
                {'sticky': 'news', 'border': [4, 6, 24, 15],
                 'padding': [4, 4, 5]}
            )
        },
        "Menubutton.indicator": {"element create":
            ("image", 'arrow-d', {"sticky": "e", "border": [15, 0, 0, 0]})
        },

        "Combobox.field": {"element create":
            ("image", 'combo-n',
                ('readonly', 'active', 'combo-ra'),
                ('focus', 'active', 'combo-fa'),
                ('active', 'combo-a'), ('!readonly', 'focus', 'combo-f'),
                ('readonly', 'combo-r'),
                {'border': [4, 6, 24, 15], 'padding': [4, 4, 5],
                 'sticky': 'news'}
            )
        },
        "Combobox.downarrow": {"element create":
            ("image", 'arrow-d', {'sticky': 'e', 'border': [15, 0, 0, 0]})
         },

        "Notebook.client": {"element create":
            ("image", 'notebook-c', {'border': 4})
        },
        "Notebook.tab": {"element create":
            ("image", 'notebook-tn',
                ("selected", 'notebook-ts'), ("active", 'notebook-ta'),
                {'padding': [0, 2, 0, 0], 'border': [4, 10, 4, 10]}
            )
        },

        "Progressbar.trough": {"element create":
            ("image", 'hprogress-t', {'border': 2})
        },
        "Horizontal.Progressbar.pbar": {"element create":
            ("image", 'hprogress-b', {'border': [2, 9]})
        },
        "Vertical.Progressbar.pbar": {"element create":
            ("image", 'vprogress-b', {'border': [9, 2]})
        },

        "Treeheading.cell": {"element create":
            ("image", 'tree-n',
                ("pressed", 'tree-p'),
                {'border': [4, 10], 'padding': 4, 'sticky': 'news'}
            )
        }

    })
    style.theme_use("plastik")
PK�
Q\�xU�eettk/img/close.gifnu�[���GIF89a�;;;������;;;;;;;;;;;;!�Created with GIMP!�
,0DJ�'!��	��晅a�A	;PK�
Q\�|!eettk/img/close_pressed.gifnu�[���GIF89a��**�ff���;;;;;;;;;;;;!�Created with GIMP!�
,0DJ�'!��	��晅a�A	;PK�
Q\�.�PPttk/img/close_active.gifnu�[���GIF89a�����4���������������!�
,0DJ�'!��	��晅a�A	;PK�
Q\a�kJ�
�
ttk/widget_state.pynu�[���"""Sample demo showing widget states and some font styling."""
import ttk

states = ['active', 'disabled', 'focus', 'pressed', 'selected',
          'background', 'readonly', 'alternate', 'invalid']

for state in states[:]:
    states.append("!" + state)

def reset_state(widget):
    nostate = states[len(states) // 2:]
    widget.state(nostate)

class App(ttk.Frame):
    def __init__(self, title=None):
        ttk.Frame.__init__(self, borderwidth=6)
        self.master.title(title)

        self.style = ttk.Style()

        # get default font size and family
        btn_font = self.style.lookup("TButton", "font")
        fsize = str(self.tk.eval("font configure %s -size" % btn_font))
        self.font_family = self.tk.eval("font configure %s -family" % btn_font)
        if ' ' in self.font_family:
            self.font_family = '{%s}' % self.font_family
        self.fsize_prefix = fsize[0] if fsize[0] == '-' else ''
        self.base_fsize = int(fsize[1 if fsize[0] == '-' else 0:])

        # a list to hold all the widgets that will have their states changed
        self.update_widgets = []

        self._setup_widgets()

    def _set_font(self, extra=0):
        self.style.configure("TButton", font="%s %s%d" % (self.font_family,
            self.fsize_prefix, self.base_fsize + extra))

    def _new_state(self, widget, newtext):
        widget = self.nametowidget(widget)

        if not newtext:
            goodstates = ["disabled"]
            font_extra = 0
        else:
            # set widget state according to what has been entered in the entry
            newstates = set(newtext.split()) # eliminate duplicates

            # keep only the valid states
            goodstates = [state for state in newstates if state in states]
            # define a new font size based on amount of states
            font_extra = 2 * len(goodstates)

        # set new widget state
        for widget in self.update_widgets:
            reset_state(widget) # remove any previous state from the widget
            widget.state(goodstates)

        # update Ttk Button font size
        self._set_font(font_extra)
        return 1

    def _setup_widgets(self):
        btn = ttk.Button(self, text='Enter states and watch')

        entry = ttk.Entry(self, cursor='xterm', validate="key")
        entry['validatecommand'] = (self.register(self._new_state), '%W', '%P')
        entry.focus()

        self.update_widgets.append(btn)
        entry.validate()

        entry.pack(fill='x', padx=6)
        btn.pack(side='left', pady=6, padx=6, anchor='n')
        self.pack(fill='both', expand=1)


def main():
    app = App("Widget State Tester")
    app.mainloop()

if __name__ == "__main__":
    main()
PK�
Q\xa��##ttk/roundframe.pycnu�[����
��^c	@s�dZddlZddlZej�Zejddd�Zejddd�Zej�Z	e	j
dd	dd%ddd
d�e	jddidd
6fg�e	jddd�ej
dddd�Zejdd�ej
dddd�Zejdddd�ejedd�Zejdd�ejdd��ejdd��ejeddd d!d"d�Zejdddd�ejdd#��ejdd$��ej�dS(&shTtk Frame with rounded corners.

Based on an example by Bryan Oakley, found at: http://wiki.tcl.tk/20152i����NtframeFocusBordertdatas�
R0lGODlhQABAAPcAAHx+fMTCxKSipOTi5JSSlNTS1LSytPTy9IyKjMzKzKyq
rOzq7JyanNza3Ly6vPz6/ISChMTGxKSmpOTm5JSWlNTW1LS2tPT29IyOjMzO
zKyurOzu7JyenNze3Ly+vPz+/OkAKOUA5IEAEnwAAACuQACUAAFBAAB+AFYd
QAC0AABBAAB+AIjMAuEEABINAAAAAHMgAQAAAAAAAAAAAKjSxOIEJBIIpQAA
sRgBMO4AAJAAAHwCAHAAAAUAAJEAAHwAAP+eEP8CZ/8Aif8AAG0BDAUAAJEA
AHwAAIXYAOfxAIESAHwAAABAMQAbMBZGMAAAIEggJQMAIAAAAAAAfqgaXESI
5BdBEgB+AGgALGEAABYAAAAAAACsNwAEAAAMLwAAAH61MQBIAABCM8B+AAAU
AAAAAAAApQAAsf8Brv8AlP8AQf8Afv8AzP8A1P8AQf8AfgAArAAABAAADAAA
AACQDADjAAASAAAAAACAAADVABZBAAB+ALjMwOIEhxINUAAAANIgAOYAAIEA
AHwAAGjSAGEEABYIAAAAAEoBB+MAAIEAAHwCACABAJsAAFAAAAAAAGjJAGGL
AAFBFgB+AGmIAAAQAABHAAB+APQoAOE/ABIAAAAAAADQAADjAAASAAAAAPiF
APcrABKDAAB8ABgAGO4AAJAAqXwAAHAAAAUAAJEAAHwAAP8AAP8AAP8AAP8A
AG0pIwW3AJGSAHx8AEocI/QAAICpAHwAAAA0SABk6xaDEgB8AAD//wD//wD/
/wD//2gAAGEAABYAAAAAAAC0/AHj5AASEgAAAAA01gBkWACDTAB8AFf43PT3
5IASEnwAAOAYd+PuMBKQTwB8AGgAEGG35RaSEgB8AOj/NOL/ZBL/gwD/fMkc
q4sA5UGpEn4AAIg02xBk/0eD/358fx/4iADk5QASEgAAAALnHABkAACDqQB8
AMyINARkZA2DgwB8fBABHL0AAEUAqQAAAIAxKOMAPxIwAAAAAIScAOPxABIS
AAAAAIIAnQwA/0IAR3cAACwAAAAAQABAAAAI/wA/CBxIsKDBgwgTKlzIsKFD
gxceNnxAsaLFixgzUrzAsWPFCw8kDgy5EeQDkBxPolypsmXKlx1hXnS48UEH
CwooMCDAgIJOCjx99gz6k+jQnkWR9lRgYYDJkAk/DlAgIMICZlizat3KtatX
rAsiCNDgtCJClQkoFMgqsu3ArBkoZDgA8uDJAwk4bGDmtm9BZgcYzK078m4D
Cgf4+l0skNkGCg3oUhR4d4GCDIoZM2ZWQMECyZQvLMggIbPmzQIyfCZ5YcME
AwFMn/bLLIKBCRtMHljQQcDV2ZqZTRDQYfWFAwMqUJANvC8zBhUWbDi5YUAB
Bsybt2VGoUKH3AcmdP+Im127xOcJih+oXsEDdvOLuQfIMGBD9QwBlsOnzcBD
hfrsuVfefgzJR599A+CnH4Hb9fcfgu29x6BIBgKYYH4DTojQc/5ZGGGGGhpU
IYIKghgiQRw+GKCEJxZIwXwWlthiQyl6KOCMLsJIIoY4LlQjhDf2mNCI9/Eo
5IYO2sjikX+9eGCRCzL5V5JALillY07GaOSVb1G5ookzEnlhlFx+8OOXZb6V
5Y5kcnlmckGmKaaMaZrpJZxWXjnnlmW++WGdZq5ZXQEetKmnlxPgl6eUYhJq
KKOI0imnoNbF2ScFHQJJwW99TsBAAAVYWEAAHEQAZoi1cQDqAAeEV0EACpT/
JqcACgRQAW6uNWCbYKcyyEwGDBgQwa2tTlBBAhYIQMFejC5AgQAWJNDABK3y
loEDEjCgV6/aOcYBAwp4kIF6rVkXgAEc8IQZVifCBRQHGqya23HGIpsTBgSU
OsFX/PbrVVjpYsCABA4kQCxHu11ogAQUIOAwATpBLDFQFE9sccUYS0wAxD5h
4DACFEggbAHk3jVBA/gtTIHHEADg8sswxyzzzDQDAAEECGAQsgHiTisZResN
gLIHBijwLQEYePzx0kw37fTSSjuMr7ZMzfcgYZUZi58DGsTKwbdgayt22GSP
bXbYY3MggQIaONDzAJ8R9kFlQheQQAAOWGCAARrwdt23Bn8H7vfggBMueOEG
WOBBAAkU0EB9oBGUdXIFZJBABAEEsPjmmnfO+eeeh/55BBEk0Ph/E8Q9meQq
bbDABAN00EADFRRQ++2254777rr3jrvjFTTQwQCpz7u6QRut5/oEzA/g/PPQ
Ry/99NIz//oGrZpUUEAAOw==tframeBorders�
R0lGODlhQABAAPcAAHx+fMTCxKSipOTi5JSSlNTS1LSytPTy9IyKjMzKzKyq
rOzq7JyanNza3Ly6vPz6/ISChMTGxKSmpOTm5JSWlNTW1LS2tPT29IyOjMzO
zKyurOzu7JyenNze3Ly+vPz+/OkAKOUA5IEAEnwAAACuQACUAAFBAAB+AFYd
QAC0AABBAAB+AIjMAuEEABINAAAAAHMgAQAAAAAAAAAAAKjSxOIEJBIIpQAA
sRgBMO4AAJAAAHwCAHAAAAUAAJEAAHwAAP+eEP8CZ/8Aif8AAG0BDAUAAJEA
AHwAAIXYAOfxAIESAHwAAABAMQAbMBZGMAAAIEggJQMAIAAAAAAAfqgaXESI
5BdBEgB+AGgALGEAABYAAAAAAACsNwAEAAAMLwAAAH61MQBIAABCM8B+AAAU
AAAAAAAApQAAsf8Brv8AlP8AQf8Afv8AzP8A1P8AQf8AfgAArAAABAAADAAA
AACQDADjAAASAAAAAACAAADVABZBAAB+ALjMwOIEhxINUAAAANIgAOYAAIEA
AHwAAGjSAGEEABYIAAAAAEoBB+MAAIEAAHwCACABAJsAAFAAAAAAAGjJAGGL
AAFBFgB+AGmIAAAQAABHAAB+APQoAOE/ABIAAAAAAADQAADjAAASAAAAAPiF
APcrABKDAAB8ABgAGO4AAJAAqXwAAHAAAAUAAJEAAHwAAP8AAP8AAP8AAP8A
AG0pIwW3AJGSAHx8AEocI/QAAICpAHwAAAA0SABk6xaDEgB8AAD//wD//wD/
/wD//2gAAGEAABYAAAAAAAC0/AHj5AASEgAAAAA01gBkWACDTAB8AFf43PT3
5IASEnwAAOAYd+PuMBKQTwB8AGgAEGG35RaSEgB8AOj/NOL/ZBL/gwD/fMkc
q4sA5UGpEn4AAIg02xBk/0eD/358fx/4iADk5QASEgAAAALnHABkAACDqQB8
AMyINARkZA2DgwB8fBABHL0AAEUAqQAAAIAxKOMAPxIwAAAAAIScAOPxABIS
AAAAAIIAnQwA/0IAR3cAACwAAAAAQABAAAAI/wA/CBxIsKDBgwgTKlzIsKFD
gxceNnxAsaLFixgzUrzAsWPFCw8kDgy5EeQDkBxPolypsmXKlx1hXnS48UEH
CwooMCDAgIJOCjx99gz6k+jQnkWR9lRgYYDJkAk/DlAgIMICkVgHLoggQIPT
ighVJqBQIKvZghkoZDgA8uDJAwk4bDhLd+ABBmvbjnzbgMKBuoA/bKDQgC1F
gW8XKMgQOHABBQsMI76wIIOExo0FZIhM8sKGCQYCYA4cwcCEDSYPLOgg4Oro
uhMEdOB84cCAChReB2ZQYcGGkxsGFGCgGzCFCh1QH5jQIW3xugwSzD4QvIIH
4s/PUgiQYcCG4BkC5P/ObpaBhwreq18nb3Z79+8Dwo9nL9I8evjWsdOX6D59
fPH71Xeef/kFyB93/sln4EP2Ebjegg31B5+CEDLUIH4PVqiQhOABqKFCF6qn
34cHcfjffCQaFOJtGaZYkIkUuljQigXK+CKCE3po40A0trgjjDru+EGPI/6I
Y4co7kikkAMBmaSNSzL5gZNSDjkghkXaaGIBHjwpY4gThJeljFt2WSWYMQpZ
5pguUnClehS4tuMEDARQgH8FBMBBBExGwIGdAxywXAUBKHCZkAIoEEAFp33W
QGl47ZgBAwZEwKigE1SQgAUCUDCXiwtQIIAFCTQwgaCrZeCABAzIleIGHDD/
oIAHGUznmXABGMABT4xpmBYBHGgAKGq1ZbppThgAG8EEAW61KwYMSOBAApdy
pNp/BkhAAQLcEqCTt+ACJW645I5rLrgEeOsTBtwiQIEElRZg61sTNBBethSw
CwEA/Pbr778ABywwABBAgAAG7xpAq6mGUUTdAPZ6YIACsRKAAbvtZqzxxhxn
jDG3ybbKFHf36ZVYpuE5oIGhHMTqcqswvyxzzDS/HDMHEiiggQMLDxCZXh8k
BnEBCQTggAUGGKCB0ktr0PTTTEfttNRQT22ABR4EkEABDXgnGUEn31ZABglE
EEAAWaeN9tpqt832221HEEECW6M3wc+Hga3SBgtMODBABw00UEEBgxdO+OGG
J4744oZzXUEDHQxwN7F5G7QRdXxPoPkAnHfu+eeghw665n1vIKhJBQUEADs=tRoundedFrametimagetfocustborderitstickytnsewtTEntrytborderwidthitstyletpaddingi
tfilltxtbothtexpandittexttTests	<FocusIn>cCstjdg�S(NR(tframetstate(tevt((s3/usr/lib64/python2.7/Demo/tkinter/ttk/roundframe.pyt<lambda>gts
<FocusOut>cCstjdg�S(Ns!focus(RR(R((s3/usr/lib64/python2.7/Demo/tkinter/ttk/roundframe.pyRhRtbgtwhitethighlightthicknesscCstjdg�S(NR(tframe2R(R((s3/usr/lib64/python2.7/Demo/tkinter/ttk/roundframe.pyRlRcCstjdg�S(Ns!focus(RR(R((s3/usr/lib64/python2.7/Demo/tkinter/ttk/roundframe.pyRmR(RR(t__doc__tTkintertttktTktroott
PhotoImagetimg1timg2tStyleRtelement_createtlayoutt	configuretFrameRtpackRtEntrytentrytbindtTextRtmainloop(((s3/usr/lib64/python2.7/Demo/tkinter/ttk/roundframe.pyt<module>s2&	$	 !PK�
Q\n�nF�	�	ttk/notebook_closebtn.pynu�[���"""A Ttk Notebook with close buttons.

Based on an example by patthoyts, http://paste.tclers.tk/896
"""
import os
import Tkinter
import ttk

root = Tkinter.Tk()

imgdir = os.path.join(os.path.dirname(__file__), 'img')
i1 = Tkinter.PhotoImage("img_close", file=os.path.join(imgdir, 'close.gif'))
i2 = Tkinter.PhotoImage("img_closeactive",
    file=os.path.join(imgdir, 'close_active.gif'))
i3 = Tkinter.PhotoImage("img_closepressed",
    file=os.path.join(imgdir, 'close_pressed.gif'))

style = ttk.Style()

style.element_create("close", "image", "img_close",
    ("active", "pressed", "!disabled", "img_closepressed"),
    ("active", "!disabled", "img_closeactive"), border=8, sticky='')

style.layout("ButtonNotebook", [("ButtonNotebook.client", {"sticky": "nswe"})])
style.layout("ButtonNotebook.Tab", [
    ("ButtonNotebook.tab", {"sticky": "nswe", "children":
        [("ButtonNotebook.padding", {"side": "top", "sticky": "nswe",
                                     "children":
            [("ButtonNotebook.focus", {"side": "top", "sticky": "nswe",
                                       "children":
                [("ButtonNotebook.label", {"side": "left", "sticky": ''}),
                 ("ButtonNotebook.close", {"side": "left", "sticky": ''})]
            })]
        })]
    })]
)

def btn_press(event):
    x, y, widget = event.x, event.y, event.widget
    elem = widget.identify(x, y)
    index = widget.index("@%d,%d" % (x, y))

    if "close" in elem:
        widget.state(['pressed'])
        widget.pressed_index = index

def btn_release(event):
    x, y, widget = event.x, event.y, event.widget

    if not widget.instate(['pressed']):
        return

    elem =  widget.identify(x, y)
    index = widget.index("@%d,%d" % (x, y))

    if "close" in elem and widget.pressed_index == index:
        widget.forget(index)
        widget.event_generate("<<NotebookClosedTab>>")

    widget.state(["!pressed"])
    widget.pressed_index = None


root.bind_class("TNotebook", "<ButtonPress-1>", btn_press, True)
root.bind_class("TNotebook", "<ButtonRelease-1>", btn_release)

# create a ttk notebook with our custom style, and add some tabs to it
nb = ttk.Notebook(width=200, height=200, style="ButtonNotebook")
nb.pressed_index = None
f1 = Tkinter.Frame(nb, background="red")
f2 = Tkinter.Frame(nb, background="green")
f3 = Tkinter.Frame(nb, background="blue")
nb.add(f1, text='Red', padding=3)
nb.add(f2, text='Green', padding=3)
nb.add(f3, text='Blue', padding=3)
nb.pack(expand=1, fill='both')

root.mainloop()
PK�
Q\�O���ttk/dirbrowser.pyonu�[����
��^c	@s�dZddlZddlZddlZddlZd�Zd�Zd�Zd�Zd�Z	ej
�Zejdd	�Z
ejdd
�Zejdd)dddd�dd��Zeje
d<ejed<ejddddd�ejddddd�ejddddd�ee�ejde�ejd e�ejd!dd"dd#d$�e
jd!d%d"dd#d&�ejd!dd"d%d#d'�ejdd(d%�ejdd(d%�ej�dS(*s`A directory browser using Ttk Treeview.

Based on the demo found in Tk 8.5 library/demos/browse
i����Nc
	Cs�|j|d�dkrdS|j|d�}|j|j|��|j|�}|r_gntjd�tjd�}x1|tj|�D]}d}tjj	||�j
dd�}tjj|�r�d}ntjj|�r�d}ntjj
|�d	}|j|d
d|d||g�}|dkrs|dkr�|j|d
dd�|j|d|�q�q�|dkr�tj|�j}	|j|dd|	�q�q�WdS(Nttypet	directorytfullpatht.s..s\t/tfileitendttexttvaluesitdummytsizes%d bytes(Rs..(tsettdeletetget_childrentparenttglobtostlistdirtNonetpathtjointreplacetisdirtisfiletsplittinserttitemtstattst_size(
ttreetnodeRRtspecial_dirstptptypetfnametidR
((s3/usr/lib64/python2.7/Demo/tkinter/ttk/dirbrowser.pyt
populate_tree
s,(!		$cCsStjjd�jdd�}|jddd|d|dg�}t||�dS(	NRs\RtRRRR(RRtabspathRRR$(RtdirR((s3/usr/lib64/python2.7/Demo/tkinter/ttk/dirbrowser.pytpopulate_roots&s$cCs |j}t||j��dS(N(twidgetR$tfocus(teventR((s3/usr/lib64/python2.7/Demo/tkinter/ttk/dirbrowser.pytupdate_tree+s	cCs�|j}|j�}|j|�r�tjj|j|d��}tjj|�r�tj|�|j	|j
d��t|�q�ndS(NRR%(R)R*RRRR&RRtchdirRR
R((R+RRR((s3/usr/lib64/python2.7/Demo/tkinter/ttk/dirbrowser.pyt
change_dir/s	
cCs\t|�t|�}}|dkr>|dkr>|j�n
|j�|j||�dS(s"Hide and show scrollbar as needed.iiN(tfloattgrid_removetgridR(tsbartfirsttlast((s3/usr/lib64/python2.7/Demo/tkinter/ttk/dirbrowser.pyt
autoscroll9s


torienttverticalt
horizontaltcolumnsRRR
tdisplaycolumnstyscrollcommandcCstt||�S(N(R5tvsb(tftl((s3/usr/lib64/python2.7/Demo/tkinter/ttk/dirbrowser.pyt<lambda>HR%txscrollcommandcCstt||�S(N(R5thsb(R=R>((s3/usr/lib64/python2.7/Demo/tkinter/ttk/dirbrowser.pyR?IR%tcommands#0RsDirectory Structuretanchortws	File Sizetstretchitwidthids<<TreeviewOpen>>s<Double-Button-1>tcolumntrowtstickytnsweitnstewtweight(RRR
(t__doc__RRtTkintertttkR$R(R,R.R5tTktroott	ScrollbarR<RAtTreeviewRtyviewtxviewtheadingRGtbindR1tgrid_columnconfiguretgrid_rowconfiguretmainloop(((s3/usr/lib64/python2.7/Demo/tkinter/ttk/dirbrowser.pyt<module>s:				
		


PK�
Q\��$&$&ttk/ttkcalendar.pycnu�[����
��^c@s{dZddlZddlZddlZddlZd�Zdejfd��YZd�Ze	dkrwe�ndS(sQ
Simple calendar using ttk Treeview together with calendar and datetime
classes.
i����NcCs-|dkrtj|�Stj||�SdS(N(tNonetcalendartTextCalendartLocaleTextCalendar(tlocaletfwday((s4/usr/lib64/python2.7/Demo/tkinter/ttk/ttkcalendar.pytget_calendar
s
tCalendarcBs�eZejjZejjZdd�Zd�Zd�Zd�Z	d�Z
d�Zd�Zd�Z
d�Zd	�Zd
�Zd�Zd�Zed
��ZRS(c
KsY|jdtj�}|jd|jj�j�}|jd|jj�j�}|jdd�}|jdd�}|jdd�}|j||d	�|_d|_	t
jj|||�t
||�|_|j�|j�|j�|j||�gtd
�D]!}	|jjddd
d�^q|_|j�|jjd|j�dS(s�
        WIDGET-SPECIFIC OPTIONS

            locale, firstweekday, year, month, selectbackground,
            selectforeground
        tfirstweekdaytyeartmonthRtselectbackgrounds#ecffc4tselectforegrounds#05640eiittendtvaluess<Map>N(tpopRtMONDAYtdatetimetnowR	R
Rt_datet
_selectiontttktFramet__init__Rt_calt_Calendar__setup_stylest_Calendar__place_widgetst_Calendar__config_calendart_Calendar__setup_selectiontranget	_calendartinsertt_itemst_build_calendartbindt_Calendar__minsize(
tselftmastertkwRR	R
Rtsel_bgtsel_fgt_((s4/usr/lib64/python2.7/Demo/tkinter/ttk/ttkcalendar.pyRs$	


4
cCs�|dkrtd|��n]|dkr;||jd<nA|dkrf|jj|jjd|�ntjj|||�dS(	NR	R
sattribute '%s' is not writeableRt
backgroundRtitem(R	R
(tAttributeErrort_canvast
itemconfigurettextRRt__setitem__(R%R,tvalue((s4/usr/lib64/python2.7/Demo/tkinter/ttk/ttkcalendar.pyR1<scCs�|dkrt|j|�S|dkr3|jdS|dkrX|jj|jjd�Stjitjj||�|6�}||SdS(NR	R
RR+Rtfill(R	R
(	tgetattrRR.titemcgetR0Rt
tclobjs_to_pyRt__getitem__(R%R,tr((s4/usr/lib64/python2.7/Demo/tkinter/ttk/ttkcalendar.pyR7Fs%cCsKtj|j�}d�}|jd|d��|jd|d��dS(NcSs!did|dfgd6fgS(NsButton.focussButton.%sarrowtchildren(R(tdir((s4/usr/lib64/python2.7/Demo/tkinter/ttk/ttkcalendar.pyt<lambda>Tss	L.TButtontlefts	R.TButtontright(RtStyleR&tlayout(R%tstyletarrow_layout((s4/usr/lib64/python2.7/Demo/tkinter/ttk/ttkcalendar.pyt__setup_stylesQs	c	Cs&tj|�}tj|ddd|j�}tj|ddd|j�}tj|dddd�|_tjd	d
ddd
d�|_|j	d|dddddd�|j
d|�|jj
d|dddddd�|j
d|dddd�|jj	d|dddddd�dS(NR@s	L.TButtontcommands	R.TButtontwidthitanchortcentertshowR
t
selectmodetnonetheightitin_tsidettoptpadyitcolumnitrowitpadxiitexpandR3tbothtbottom(RRtButtont_prev_montht_next_monthtLabelt_headertTreeviewRtpacktgrid(R%thframetlbtntrbtn((s4/usr/lib64/python2.7/Demo/tkinter/ttk/ttkcalendar.pyt__place_widgetsZs!"%c	s�|jjd�j�}||jd<|jjddd�|jjddd|d	d�tj��t�fd
�|D��}x0|D](}|jj	|d|d|d
d�q�WdS(NitcolumnstheaderR+tgrey90R
RRttagc3s|]}�j|�VqdS(N(tmeasure(t.0tcol(tfont(s4/usr/lib64/python2.7/Demo/tkinter/ttk/ttkcalendar.pys	<genexpr>qsRDtminwidthREte(
RtformatweekheadertsplitRt
tag_configureR ttkFonttFonttmaxRO(R%tcolstmaxwidthRg((Rhs4/usr/lib64/python2.7/Demo/tkinter/ttk/ttkcalendar.pyt__config_calendarjs

cs�tj�|_tj|jd|dddd�|_��jddd|dd��_�j	d�fd	��|jj	d
�fd��|jj	d|j
�dS(NR+tborderwidthithighlightthicknessR3REtws<ButtonPress-1>cs
�j�S(N(tplace_forget(tevt(tcanvas(s4/usr/lib64/python2.7/Demo/tkinter/ttk/ttkcalendar.pyR;|R
s<Configure>cs
�j�S(N(Rw(Rx(Ry(s4/usr/lib64/python2.7/Demo/tkinter/ttk/ttkcalendar.pyR;}R
(RnRot_fonttTkintertCanvasRR.tcreate_textR0R#t_pressed(R%R(R)((Rys4/usr/lib64/python2.7/Demo/tkinter/ttk/ttkcalendar.pyt__setup_selectionvs!cCsN|jjj�jd�\}}||jd� }|jjj||�dS(Ntxt+(RR&tgeometryRltindextminsize(R%RxRDRJ((s4/usr/lib64/python2.7/Demo/tkinter/ttk/ttkcalendar.pyt	__minsize�s!c
Cs�|jj|jj}}|jj||d�}|j�|jd<|jj||�}x~t|j	�D]m\}}|t
|�kr�||ng}g|D]}|r�d|nd^q�}	|jj|d|	�qiWdS(NiR0s%02dR
R(
RR	R
RtformatmonthnamettitleRYtmonthdayscalendart	enumerateR!tlenRR,(
R%R	R
RbtcaltindxR,tweektdaytfmt_week((s4/usr/lib64/python2.7/Demo/tkinter/ttk/ttkcalendar.pyR"�s")c	Cs�|\}}}}|jj|�}|j}|jd|d|�|j|j|||dd�|j|jd|�|jd|jd|d|�d	S(
s%Configure canvas for a new selection.RDRJiiR0RKR�tyN(	RzReR.t	configuretcoordsR0R/tplaceR(	R%R0tbboxR�R�RDRJttextwRy((s4/usr/lib64/python2.7/Demo/tkinter/ttk/ttkcalendar.pyt_show_selection�s	"c
Cs�|j|j|j}}}|j|�}|j|�}|sQ||jkrUdS|j|�d}t|�sxdS|t|d�d}|s�dS|j	||�}	|	s�dSd|}|||f|_
|j||	�dS(s"Clicked somewhere in the calendar.NRis%02d(R�R�twidgettidentify_rowtidentify_columnR!R,R�tintR�RR�(
R%RxR�R�R�R,ROtitem_valuesR0R�((s4/usr/lib64/python2.7/Demo/tkinter/ttk/ttkcalendar.pyR~�s"
cCs[|jj�|j|jdd�|_|j|jj|jjd�|_|j�dS(s,Updated calendar to show the previous month.tdaysiN(R.RwRt	timedeltaRR	R
R"(R%((s4/usr/lib64/python2.7/Demo/tkinter/ttk/ttkcalendar.pyRV�s
$cCs�|jj�|jj|jj}}|j|jdtj||�dd�|_|j|jj|jjd�|_|j	�dS(s'Update calendar to show the next month.R�iN(
R.RwRR	R
R�Rt
monthrangeRR"(R%R	R
((s4/usr/lib64/python2.7/Demo/tkinter/ttk/ttkcalendar.pyRW�s
!$cCsF|js
dS|jj|jj}}|j||t|jd��S(s9Return a datetime representing the current selected date.iN(RRRR	R
RR�(R%R	R
((s4/usr/lib64/python2.7/Demo/tkinter/ttk/ttkcalendar.pyt	selection�s	N(t__name__t
__module__RRR�RRR1R7RRRRR$R"R�R~RVRWtpropertyR�(((s4/usr/lib64/python2.7/Demo/tkinter/ttk/ttkcalendar.pyRs %	
						
						cCs�ddl}tj�}|jd�tdtj�}|jdddd�d|jkrxt	j
�}|jd	�n|j�dS(
Ni����sTtk CalendarRRRiR3RStwintclam(
tsysR{tTkR�RRtSUNDAYR[tplatformRR>t	theme_usetmainloop(R�troottttkcalR@((s4/usr/lib64/python2.7/Demo/tkinter/ttk/ttkcalendar.pyttest�s
t__main__(
t__doc__RR{RnRRRRR�R�(((s4/usr/lib64/python2.7/Demo/tkinter/ttk/ttkcalendar.pyt<module>s	�	
PK�
Q\�8�~ ~ ttk/ttkcalendar.pynu�[���"""
Simple calendar using ttk Treeview together with calendar and datetime
classes.
"""
import calendar
import Tkinter
import tkFont
import ttk

def get_calendar(locale, fwday):
    # instantiate proper calendar class
    if locale is None:
        return calendar.TextCalendar(fwday)
    else:
        return calendar.LocaleTextCalendar(fwday, locale)

class Calendar(ttk.Frame):
    # XXX ToDo: cget and configure

    datetime = calendar.datetime.datetime
    timedelta = calendar.datetime.timedelta

    def __init__(self, master=None, **kw):
        """
        WIDGET-SPECIFIC OPTIONS

            locale, firstweekday, year, month, selectbackground,
            selectforeground
        """
        # remove custom options from kw before initializating ttk.Frame
        fwday = kw.pop('firstweekday', calendar.MONDAY)
        year = kw.pop('year', self.datetime.now().year)
        month = kw.pop('month', self.datetime.now().month)
        locale = kw.pop('locale', None)
        sel_bg = kw.pop('selectbackground', '#ecffc4')
        sel_fg = kw.pop('selectforeground', '#05640e')

        self._date = self.datetime(year, month, 1)
        self._selection = None # no date selected

        ttk.Frame.__init__(self, master, **kw)

        self._cal = get_calendar(locale, fwday)

        self.__setup_styles()       # creates custom styles
        self.__place_widgets()      # pack/grid used widgets
        self.__config_calendar()    # adjust calendar columns and setup tags
        # configure a canvas, and proper bindings, for selecting dates
        self.__setup_selection(sel_bg, sel_fg)

        # store items ids, used for insertion later
        self._items = [self._calendar.insert('', 'end', values='')
                            for _ in range(6)]
        # insert dates in the currently empty calendar
        self._build_calendar()

        # set the minimal size for the widget
        self._calendar.bind('<Map>', self.__minsize)

    def __setitem__(self, item, value):
        if item in ('year', 'month'):
            raise AttributeError("attribute '%s' is not writeable" % item)
        elif item == 'selectbackground':
            self._canvas['background'] = value
        elif item == 'selectforeground':
            self._canvas.itemconfigure(self._canvas.text, item=value)
        else:
            ttk.Frame.__setitem__(self, item, value)

    def __getitem__(self, item):
        if item in ('year', 'month'):
            return getattr(self._date, item)
        elif item == 'selectbackground':
            return self._canvas['background']
        elif item == 'selectforeground':
            return self._canvas.itemcget(self._canvas.text, 'fill')
        else:
            r = ttk.tclobjs_to_py({item: ttk.Frame.__getitem__(self, item)})
            return r[item]

    def __setup_styles(self):
        # custom ttk styles
        style = ttk.Style(self.master)
        arrow_layout = lambda dir: (
            [('Button.focus', {'children': [('Button.%sarrow' % dir, None)]})]
        )
        style.layout('L.TButton', arrow_layout('left'))
        style.layout('R.TButton', arrow_layout('right'))

    def __place_widgets(self):
        # header frame and its widgets
        hframe = ttk.Frame(self)
        lbtn = ttk.Button(hframe, style='L.TButton', command=self._prev_month)
        rbtn = ttk.Button(hframe, style='R.TButton', command=self._next_month)
        self._header = ttk.Label(hframe, width=15, anchor='center')
        # the calendar
        self._calendar = ttk.Treeview(show='', selectmode='none', height=7)

        # pack the widgets
        hframe.pack(in_=self, side='top', pady=4, anchor='center')
        lbtn.grid(in_=hframe)
        self._header.grid(in_=hframe, column=1, row=0, padx=12)
        rbtn.grid(in_=hframe, column=2, row=0)
        self._calendar.pack(in_=self, expand=1, fill='both', side='bottom')

    def __config_calendar(self):
        cols = self._cal.formatweekheader(3).split()
        self._calendar['columns'] = cols
        self._calendar.tag_configure('header', background='grey90')
        self._calendar.insert('', 'end', values=cols, tag='header')
        # adjust its columns width
        font = tkFont.Font()
        maxwidth = max(font.measure(col) for col in cols)
        for col in cols:
            self._calendar.column(col, width=maxwidth, minwidth=maxwidth,
                anchor='e')

    def __setup_selection(self, sel_bg, sel_fg):
        self._font = tkFont.Font()
        self._canvas = canvas = Tkinter.Canvas(self._calendar,
            background=sel_bg, borderwidth=0, highlightthickness=0)
        canvas.text = canvas.create_text(0, 0, fill=sel_fg, anchor='w')

        canvas.bind('<ButtonPress-1>', lambda evt: canvas.place_forget())
        self._calendar.bind('<Configure>', lambda evt: canvas.place_forget())
        self._calendar.bind('<ButtonPress-1>', self._pressed)

    def __minsize(self, evt):
        width, height = self._calendar.master.geometry().split('x')
        height = height[:height.index('+')]
        self._calendar.master.minsize(width, height)

    def _build_calendar(self):
        year, month = self._date.year, self._date.month

        # update header text (Month, YEAR)
        header = self._cal.formatmonthname(year, month, 0)
        self._header['text'] = header.title()

        # update calendar shown dates
        cal = self._cal.monthdayscalendar(year, month)
        for indx, item in enumerate(self._items):
            week = cal[indx] if indx < len(cal) else []
            fmt_week = [('%02d' % day) if day else '' for day in week]
            self._calendar.item(item, values=fmt_week)

    def _show_selection(self, text, bbox):
        """Configure canvas for a new selection."""
        x, y, width, height = bbox

        textw = self._font.measure(text)

        canvas = self._canvas
        canvas.configure(width=width, height=height)
        canvas.coords(canvas.text, width - textw, height / 2 - 1)
        canvas.itemconfigure(canvas.text, text=text)
        canvas.place(in_=self._calendar, x=x, y=y)

    # Callbacks

    def _pressed(self, evt):
        """Clicked somewhere in the calendar."""
        x, y, widget = evt.x, evt.y, evt.widget
        item = widget.identify_row(y)
        column = widget.identify_column(x)

        if not column or not item in self._items:
            # clicked in the weekdays row or just outside the columns
            return

        item_values = widget.item(item)['values']
        if not len(item_values): # row is empty for this month
            return

        text = item_values[int(column[1]) - 1]
        if not text: # date is empty
            return

        bbox = widget.bbox(item, column)
        if not bbox: # calendar not visible yet
            return

        # update and then show selection
        text = '%02d' % text
        self._selection = (text, item, column)
        self._show_selection(text, bbox)

    def _prev_month(self):
        """Updated calendar to show the previous month."""
        self._canvas.place_forget()

        self._date = self._date - self.timedelta(days=1)
        self._date = self.datetime(self._date.year, self._date.month, 1)
        self._build_calendar() # reconstruct calendar

    def _next_month(self):
        """Update calendar to show the next month."""
        self._canvas.place_forget()

        year, month = self._date.year, self._date.month
        self._date = self._date + self.timedelta(
            days=calendar.monthrange(year, month)[1] + 1)
        self._date = self.datetime(self._date.year, self._date.month, 1)
        self._build_calendar() # reconstruct calendar

    # Properties

    @property
    def selection(self):
        """Return a datetime representing the current selected date."""
        if not self._selection:
            return None

        year, month = self._date.year, self._date.month
        return self.datetime(year, month, int(self._selection[0]))

def test():
    import sys
    root = Tkinter.Tk()
    root.title('Ttk Calendar')
    ttkcal = Calendar(firstweekday=calendar.SUNDAY)
    ttkcal.pack(expand=1, fill='both')

    if 'win' not in sys.platform:
        style = ttk.Style()
        style.theme_use('clam')

    root.mainloop()

if __name__ == '__main__':
    test()
PK�
Q\�j:�^^ttk/plastik_theme.pycnu�[����
��^c@s�dZddlZddlZddlZddlmZdgZidd6dd6d	d
6dd6ZiZd
�Z	d�Z
dS(ssThis demonstrates good part of the syntax accepted by theme_create.

This is a translation of plastik.tcl to python.
You will need the images used by the plastik theme to test this. The
images (and other tile themes) can be retrived by doing:

$ cvs -z3 -d:pserver:anonymous@tktable.cvs.sourceforge.net:/cvsroot/tktable   co tile-themes

To test this module you should do, for example:

import Tkinter
import plastik_theme

root = Tkinter.Tk()
plastik_theme.install(plastik_image_dir)
...

Where plastik_image_dir contains the path to the images directory used by
the plastik theme, something like: tile-themes/plastik/plastik
i����N(t
PhotoImagetinstalls#efefeftframes#aaaaaat
disabledfgs#657a9etselectbgs#fffffftselectfgcCs�tjj|�}tjj|�s7td|��nxWtjd|�D]B}tjj|�d}|d }t|d|dd�t|<qKWdS(Ns(%r is not a directory, can't load imagess%s/*.gifii����tfiletformattgif89(	tostpatht
expandusertisdirt	ExceptiontglobtsplitRtimgs(timgdirtftimgtname((s6/usr/lib64/python2.7/Demo/tkinter/ttk/plastik_theme.pyt
_load_imgs%s
cCs=t|�tj�}|jdddi'iitdd6tdd6tdd6td	d
6tdd6dd
6dd6d6idtdfgd6d6d6ididd6dd6fdidd6dd6fdidd6dd6fdidd6didd 6dd!6d"idd6fgd#6fgd#6fgd$6d%6id&id'd6dd6fd(id)d6dd6fd&id)d6dd6fd*id+d6d,idd 6dd!6d-idd6fgd#6fgd#6fgd$6d.6iid/d06d1d26d6d3id4id5id6id'd6dd 6fgd#6fgd#6fgd#6fgd$6d76iid1d26d6d8id9id:id;id'd6dd 6fgd#6fgd#6fgd#6fgd$6d<6id=id>id)d6fd?id@idAid'd6dd 6fgd#6fgd#6fgd#6fgd$6dB6iidCdDdCdCgdE6d6dF6iidGdDdGdDgdH6dCdCdDgd 6d6idIddDdJdDgfgd 6d6dK6iidCdH6d6dL6idMdNd�d�idJd/gdS6dJdH6dTd6fdU6d36idMdVd�d�d�idJdYgdS6dZdH6d[d6fdU6d96idMd\d�d�d�d�idd6fdU6da6idMdbd�d�d�d�idd6fdU6dg6idMdhidZdS6d+d6fdU6d,6id�dU6d-6id�dU6d*6idMdkidZdS6dd6fdU6d6id�dU6d"6id�dU6d6idMdnd�idd6fdU6dp6idMdqd�idd6fdU6ds6idMdtd�idd6fdU6dv6idMdwd�idd6fdU6dy6idMdzidd6fdU6d{6idMd|iddS6dCdH6fdU6d}6idMd~idd6fdU6d6idMd�iddS6dCdH6fdU6d�6idMd�d�idDdS6dZdJgdH6d[d6fdU6d�6idMdSidJdS6dJdH6d[d6fdU6d�6idMd�d�id[d6dJdGd�d�gdS6dJdJd�gdH6fdU6d=6idMd�id�d6d�dCdCdCgdS6fdU6d>6idMd�d�d�d�d�d�idJdGd�d�gdS6dJdJd�gdH6d[d6fdU6d�6idMd�id�d6d�dCdCdCgdS6fdU6d�6idMd�idJdS6fdU6d�6idMd�d�d�idCdDdCdCgdH6dJd/dJd/gdS6fdU6d�6idMd�idDdS6fdU6d�6idMd�idDdYgdS6fdU6d�6idMd�idYdDgdS6fdU6d�6idMd�d�idJd/gdS6dJdH6d[d6fdU6d�6�|jd�dS(�NtplastiktdefaulttsettingsRt
backgroundttroughcolorRtselectbackgroundRtselectforegroundtfieldbackgroundt
TkDefaultFonttfontitborderwidtht	configuretdisabledRt
foregroundtmapt.sVertical.Scrollbar.uparrowttoptsidettstickysVertical.Scrollbar.downarrowtbottomsVertical.Scrollbar.troughtnssVertical.Scrollbar.thumbtexpandtunitsVertical.Scrollbar.griptchildrentlayoutsVertical.TScrollbarsHorizontal.Scrollbar.leftarrowtleftsHorizontal.Scrollbar.rightarrowtrightsHorizontal.Scrollbar.troughtewsHorizontal.Scrollbar.thumbsHorizontal.Scrollbar.gripsHorizontal.TScrollbari
twidthtcentertanchors
Button.buttonsButton.focussButton.paddingsButton.labeltTButtonsToolbutton.bordersToolbutton.buttonsToolbutton.paddingsToolbutton.labelt
ToolbuttonsMenubutton.buttonsMenubutton.indicatorsMenubutton.focussMenubutton.paddingsMenubutton.labeltTMenubuttoniit
tabmarginst	TNotebookitpaddingtselectedis
TNotebook.tabtTreeviewtimagesbutton-ntpressedsbutton-ptactivesbutton-htbordertewnsselement creates	tbutton-ns	tbutton-ps	tbutton-hi	itnewsscheck-nuscheck-hcscheck-pcscheck-huscheck-ncsCheckbutton.indicatorsradio-nusradio-hcsradio-pcsradio-husradio-ncsRadiobutton.indicatorshsb-nshsb-gshsb-tsvsb-nsvsb-gsvsb-ts	arrowup-ns	arrowup-psScrollbar.uparrowsarrowdown-nsarrowdown-psScrollbar.downarrowsarrowleft-nsarrowleft-psScrollbar.leftarrowsarrowright-nsarrowright-psScrollbar.rightarrows	hslider-nsHorizontal.Scale.sliders	hslider-tsHorizontal.Scale.troughs	vslider-nsVertical.Scale.sliders	vslider-tsVertical.Scale.troughsentry-ntfocussentry-fsEntry.fieldsLabelframe.borderscombo-rscombo-raiiisarrow-dtescombo-ntreadonlyscombo-fascombo-as	!readonlyscombo-fsCombobox.fieldsCombobox.downarrows
notebook-csNotebook.clientsnotebook-tnsnotebook-tssnotebook-tasNotebook.tabshprogress-tsProgressbar.troughshprogress-bsHorizontal.Progressbar.pbarsvprogress-bsVertical.Progressbar.pbarstree-nstree-psTreeheading.cell(R?sbutton-p(R@sbutton-h(R<s	tbutton-p(R?s	tbutton-p(R@s	tbutton-h(R@R<scheck-hc(R?R<scheck-pc(R@scheck-hu(R<scheck-nc(R@R<sradio-hc(R?R<sradio-pc(R@sradio-hu(R<sradio-nc(R>shsb-g(R>shsb-t(R>svsb-g(R>svsb-t(R?s	arrowup-p(R?sarrowdown-p(R?sarrowleft-p(R?sarrowright-p(RDsentry-f(R@scombo-ra(RFR@scombo-ra(RDR@scombo-fa(R@scombo-a(s	!readonlyRDscombo-f(RFscombo-r(R<snotebook-ts(R@snotebook-ta(R?stree-p(RtttktStylettheme_createtcolorst	theme_use(Rtstyle((s6/usr/lib64/python2.7/Demo/tkinter/ttk/plastik_theme.pyR.s

/
/@@@!*'))""	"")).&.4!!-(t__doc__R	RRGtTkinterRt__all__RJRRR(((s6/usr/lib64/python2.7/Demo/tkinter/ttk/plastik_theme.pyt<module>s	
		PK�
Q\���*hh#matt/entry-with-shared-variable.pyonu�[����
��^c@sSddlTddlZdefd��YZe�Zejjd�ej�dS(i����(t*NtAppcBs&eZdd�Zd�Zd�ZRS(cCs�tj||�|j�t|�|_|jj�t|ddd|j�|_|jj�t�|_	|j	j
d�|jjd|j	�|jjd|j
�dS(NttextsUppercase The Entrytcommandsthis is a variablettextvariables<Key-Return>(tFramet__init__tpacktEntrytentrythingytButtontuppertbuttont	StringVartcontentstsettconfigtbindtprint_contents(tselftmaster((sD/usr/lib64/python2.7/Demo/tkinter/matt/entry-with-shared-variable.pyRs


cCs,tj|jj��}|jj|�dS(N(tstringRRtgetR(Rtstr((sD/usr/lib64/python2.7/Demo/tkinter/matt/entry-with-shared-variable.pyR scCsdG|jj�GHdS(Ns"hi. contents of entry is now ---->(RR(Rtevent((sD/usr/lib64/python2.7/Demo/tkinter/matt/entry-with-shared-variable.pyR)sN(t__name__t
__module__tNoneRRR(((sD/usr/lib64/python2.7/Demo/tkinter/matt/entry-with-shared-variable.pyRs		tFoo(tTkinterRRRtrootRttitletmainloop(((sD/usr/lib64/python2.7/Demo/tkinter/matt/entry-with-shared-variable.pyt<module>s

&	PK�
Q\R��۩�matt/menu-simple.pyonu�[����
��^c@s�ddlTd�Zd�Zd�Zd�Ze�Zeededd�Z	e	j
d	e�e�Ze�Z
e	jee
�ejd
�ejd�ej�dS(
i����(t*cCs	dGHdS(Nsopening new file((((s5/usr/lib64/python2.7/Demo/tkinter/matt/menu-simple.pytnew_file$scCs	dGHdS(Nsopening OLD file((((s5/usr/lib64/python2.7/Demo/tkinter/matt/menu-simple.pyt	open_file(scCs�ttdddd�}|jdtdd�t|�|_|jjdd	ddd
t�|jjddddd
t�|jjddddd
d
�|j|d<|S(NttexttFilet	underlineitsidetpadxt1mtlabelsNew...tcommandsOpen...tQuittexittmenu(	t
MenubuttontmBartpacktLEFTtMenuR
tadd_commandRR(tFile_button((s5/usr/lib64/python2.7/Demo/tkinter/matt/menu-simple.pytmakeFileMenu,s
cCs�ttdddd�}|jdtdd�t|�|_|jjdd	d
�|jjddt�|jj	d	d
�|jj	d	d�|jj	d	d�|j|d<|S(NRtEditRiRRRR
R	tUndoitstatetCuttCopytPasteR
(
RRRRRR
taddtentryconfigtDISABLEDR(tEdit_button((s5/usr/lib64/python2.7/Demo/tkinter/matt/menu-simple.pytmakeEditMenuFs
trelieftborderwidthitfills	menu demotpackerN(tTkinterRRRR tTktroottFrametRAISEDRRtXRRt
tk_menuBarttitleticonnametmainloop(((s5/usr/lib64/python2.7/Demo/tkinter/matt/menu-simple.pyt<module>s
#							

PK�
Q\�D66matt/placer-simple.pynu�[���from Tkinter import *

# This is a program that tests the placer geom manager

def do_motion(event):
    app.button.place(x=event.x, y=event.y)

def dothis():
    print 'calling me!'

def createWidgets(top):
    # make a frame. Note that the widget is 200 x 200
    # and the window containing is 400x400. We do this
    # simply to show that this is possible. The rest of the
    # area is inaccesssible.
    f = Frame(top, width=200, height=200, background='green')

    # place it so the upper left hand corner of
    # the frame is in the upper left corner of
    # the parent
    f.place(relx=0.0, rely=0.0)

    # now make a button
    f.button = Button(f, foreground='red', text='amazing', command=dothis)

    # and place it so that the nw corner is
    # 1/2 way along the top X edge of its' parent
    f.button.place(relx=0.5, rely=0.0, anchor=NW)

    # allow the user to move the button SUIT-style.
    f.bind('<Control-Shift-Motion>', do_motion)

    return f

root = Tk()
app = createWidgets(root)
root.geometry("400x400")
root.maxsize(1000, 1000)
root.mainloop()
PK�
Q\��>kv	v	!matt/canvas-moving-or-creating.pynu�[���from Tkinter import *

# this file demonstrates a more sophisticated movement --
# move dots or create new ones if you click outside the dots

class Test(Frame):
    ###################################################################
    ###### Event callbacks for THE CANVAS (not the stuff drawn on it)
    ###################################################################
    def mouseDown(self, event):
        # see if we're inside a dot. If we are, it
        # gets tagged as CURRENT for free by tk.
        if not event.widget.find_withtag(CURRENT):
            # there is no dot here, so we can make one,
            # and bind some interesting behavior to it.
            # ------
            # create a dot, and mark it as CURRENT
            fred = self.draw.create_oval(
                event.x - 10, event.y -10, event.x +10, event.y + 10,
                fill="green", tags=CURRENT)

            self.draw.tag_bind(fred, "<Any-Enter>", self.mouseEnter)
            self.draw.tag_bind(fred, "<Any-Leave>", self.mouseLeave)

        self.lastx = event.x
        self.lasty = event.y

    def mouseMove(self, event):
        self.draw.move(CURRENT, event.x - self.lastx, event.y - self.lasty)
        self.lastx = event.x
        self.lasty = event.y

    ###################################################################
    ###### Event callbacks for canvas ITEMS (stuff drawn on the canvas)
    ###################################################################
    def mouseEnter(self, event):
        # the CURRENT tag is applied to the object the cursor is over.
        # this happens automatically.
        self.draw.itemconfig(CURRENT, fill="red")

    def mouseLeave(self, event):
        # the CURRENT tag is applied to the object the cursor is over.
        # this happens automatically.
        self.draw.itemconfig(CURRENT, fill="blue")

    def createWidgets(self):
        self.QUIT = Button(self, text='QUIT', foreground='red',
                           command=self.quit)
        self.QUIT.pack(side=LEFT, fill=BOTH)
        self.draw = Canvas(self, width="5i", height="5i")
        self.draw.pack(side=LEFT)

        Widget.bind(self.draw, "<1>", self.mouseDown)
        Widget.bind(self.draw, "<B1-Motion>", self.mouseMove)

    def __init__(self, master=None):
        Frame.__init__(self, master)
        Pack.config(self)
        self.createWidgets()

test = Test()
test.mainloop()
PK�
Q\�}N�

matt/pong-demo-1.pynu�[���from Tkinter import *

import string


class Pong(Frame):
    def createWidgets(self):
        self.QUIT = Button(self, text='QUIT', foreground='red',
                           command=self.quit)
        self.QUIT.pack(side=LEFT, fill=BOTH)

        ## The playing field
        self.draw = Canvas(self, width="5i", height="5i")

        ## The speed control for the ball
        self.speed = Scale(self, orient=HORIZONTAL, label="ball speed",
                           from_=-100, to=100)

        self.speed.pack(side=BOTTOM, fill=X)

        # The ball
        self.ball = self.draw.create_oval("0i", "0i", "0.10i", "0.10i",
                                          fill="red")
        self.x = 0.05
        self.y = 0.05
        self.velocity_x = 0.3
        self.velocity_y = 0.5

        self.draw.pack(side=LEFT)

    def moveBall(self, *args):
        if (self.x > 5.0) or (self.x < 0.0):
            self.velocity_x = -1.0 * self.velocity_x
        if (self.y > 5.0) or (self.y < 0.0):
            self.velocity_y = -1.0 * self.velocity_y

        deltax = (self.velocity_x * self.speed.get() / 100.0)
        deltay = (self.velocity_y * self.speed.get() / 100.0)
        self.x = self.x + deltax
        self.y = self.y + deltay

        self.draw.move(self.ball,  "%ri" % deltax, "%ri" % deltay)
        self.after(10, self.moveBall)

    def __init__(self, master=None):
        Frame.__init__(self, master)
        Pack.config(self)
        self.createWidgets()
        self.after(10, self.moveBall)


game = Pong()

game.mainloop()
PK�
Q\3��(jjmatt/window-creation-simple.pyonu�[����
��^c@s7ddlTdefd��YZe�Zej�dS(i����(t*tTestcBs/eZd�Zd�Zd�Zdd�ZRS(cCs	dGHdS(Nthi((tself((s@/usr/lib64/python2.7/Demo/tkinter/matt/window-creation-simple.pytprintitscCs/t�}t|dd�|_|jj�dS(NttextsHere's a new window(tTopleveltLabeltlabeltpack(Rtfred((s@/usr/lib64/python2.7/Demo/tkinter/matt/window-creation-simple.pyt
makeWindow	s	cCsrt|ddddd|j�|_|jjdtdt�t|ddd|j�|_|jjdt�dS(	NRtQUITt
foregroundtredtcommandtsidetfillsMake a New Window(tButtontquitRR	tLEFTtBOTHRthi_there(R((s@/usr/lib64/python2.7/Demo/tkinter/matt/window-creation-simple.pyt
createWidgetsscCs+tj||�tj|�|j�dS(N(tFramet__init__tPacktconfigR(Rtmaster((s@/usr/lib64/python2.7/Demo/tkinter/matt/window-creation-simple.pyRs
N(t__name__t
__module__RRRtNoneR(((s@/usr/lib64/python2.7/Demo/tkinter/matt/window-creation-simple.pyRs			N(tTkinterRRttesttmainloop(((s@/usr/lib64/python2.7/Demo/tkinter/matt/window-creation-simple.pyt<module>s
	PK�
Q\k�����matt/dialog-box.pyonu�[����
��^c@sGddlTddlmZdefd��YZe�Zej�dS(i����(t*(tDialogtTestcBs/eZd�Zd�Zd�Zdd�ZRS(cCs	dGHdS(Nthi((tself((s4/usr/lib64/python2.7/Demo/tkinter/matt/dialog-box.pytprintitsc
Cs1t|ddddddddd	d�}|jS(
s�Create a top-level dialog with some buttons.

        This uses the Dialog class, which is a wrapper around the Tcl/Tk
        tk_dialog script.  The function returns 0 if the user clicks 'yes'
        or 1 if the user clicks 'no'.
        ttitlesfred the dialog boxttextsclick on a choicetbitmaptinfotdefaultitstringstyestno(RR
(Rtnum(Rtd((s4/usr/lib64/python2.7/Demo/tkinter/matt/dialog-box.pyt
makeWindows	cCsrt|ddddd|j�|_|jjdtdt�t|ddd|j�|_|jjdt�dS(	NRtQUITt
foregroundtredtcommandtsidetfillsMake a New Window(tButtontquitRtpacktLEFTtBOTHRthi_there(R((s4/usr/lib64/python2.7/Demo/tkinter/matt/dialog-box.pyt
createWidgets.scCs4tj||�tj|�d|_|j�dS(Ni(tFramet__init__tPacktconfigt	windownumR(Rtmaster((s4/usr/lib64/python2.7/Demo/tkinter/matt/dialog-box.pyR9s
	N(t__name__t
__module__RRRtNoneR(((s4/usr/lib64/python2.7/Demo/tkinter/matt/dialog-box.pyRs		#	N(tTkinterRRRttesttmainloop(((s4/usr/lib64/python2.7/Demo/tkinter/matt/dialog-box.pyt<module>s
8	PK�
Q\�}�`	`	 matt/printing-coords-of-items.pynu�[���from Tkinter import *

# this file demonstrates the creation of widgets as part of a canvas object

class Test(Frame):
    ###################################################################
    ###### Event callbacks for THE CANVAS (not the stuff drawn on it)
    ###################################################################
    def mouseDown(self, event):
        # see if we're inside a dot. If we are, it
        # gets tagged as CURRENT for free by tk.

        if not event.widget.find_withtag(CURRENT):
            # there is no dot here, so we can make one,
            # and bind some interesting behavior to it.
            # ------
            # create a dot, and mark it as current
            fred = self.draw.create_oval(
                event.x - 10, event.y -10, event.x +10, event.y + 10,
                fill="green")
            self.draw.tag_bind(fred, "<Enter>", self.mouseEnter)
            self.draw.tag_bind(fred, "<Leave>", self.mouseLeave)
        self.lastx = event.x
        self.lasty = event.y

    def mouseMove(self, event):
        self.draw.move(CURRENT, event.x - self.lastx, event.y - self.lasty)
        self.lastx = event.x
        self.lasty = event.y

    ###################################################################
    ###### Event callbacks for canvas ITEMS (stuff drawn on the canvas)
    ###################################################################
    def mouseEnter(self, event):
        # the "current" tag is applied to the object the cursor is over.
        # this happens automatically.
        self.draw.itemconfig(CURRENT, fill="red")
        print self.draw.coords(CURRENT)

    def mouseLeave(self, event):
        # the "current" tag is applied to the object the cursor is over.
        # this happens automatically.
        self.draw.itemconfig(CURRENT, fill="blue")

    def createWidgets(self):
        self.QUIT = Button(self, text='QUIT', foreground='red',
                           command=self.quit)
        self.QUIT.pack(side=LEFT, fill=BOTH)
        self.draw = Canvas(self, width="5i", height="5i")
        self.draw.pack(side=LEFT)

        Widget.bind(self.draw, "<1>", self.mouseDown)
        Widget.bind(self.draw, "<B1-Motion>", self.mouseMove)

    def __init__(self, master=None):
        Frame.__init__(self, master)
        Pack.config(self)
        self.createWidgets()

test = Test()
test.mainloop()
PK�
Q\��>;��matt/packer-simple.pycnu�[����
��^c@s7ddlTdefd��YZe�Zej�dS(i����(t*tTestcBs&eZd�Zd�Zdd�ZRS(cCs|jdGHdS(Ntcommand(thi_there(tself((s7/usr/lib64/python2.7/Demo/tkinter/matt/packer-simple.pytprintitscCs�t|ddddd|j�|_|jjdtdt�t|ddd|j�|_|jjdt�t|dd	�|_|jj�t|dd
�|_	|j	j�dS(NttexttQUITt
foregroundtredRtsidetfilltHellosbutton 2sbutton 3(
tButtontquitRtpacktLEFTtBOTHRRtguy2tguy3(R((s7/usr/lib64/python2.7/Demo/tkinter/matt/packer-simple.pyt
createWidgetss
cCs+tj||�tj|�|j�dS(N(tFramet__init__tPacktconfigR(Rtmaster((s7/usr/lib64/python2.7/Demo/tkinter/matt/packer-simple.pyRs
N(t__name__t
__module__RRtNoneR(((s7/usr/lib64/python2.7/Demo/tkinter/matt/packer-simple.pyRs		N(tTkinterRRttesttmainloop(((s7/usr/lib64/python2.7/Demo/tkinter/matt/packer-simple.pyt<module>s
	PK�
Q\Mh�Ω	�	matt/canvas-moving-w-mouse.pycnu�[����
��^c@s7ddlTdefd��YZe�Zej�dS(i����(t*tTestcBsAeZd�Zd�Zd�Zd�Zd�Zdd�ZRS(cCs|j|_|j|_dS(N(txtlastxtytlasty(tselftevent((s?/usr/lib64/python2.7/Demo/tkinter/matt/canvas-moving-w-mouse.pyt	mouseDown	scCsF|jjt|j|j|j|j�|j|_|j|_dS(N(tdrawtmovetCURRENTRRRR(RR((s?/usr/lib64/python2.7/Demo/tkinter/matt/canvas-moving-w-mouse.pyt	mouseMoves*cCs|jjtdd�dS(Ntfilltred(R	t
itemconfigR(RR((s?/usr/lib64/python2.7/Demo/tkinter/matt/canvas-moving-w-mouse.pyt
mouseEnterscCs|jjtdd�dS(NR
tblue(R	RR(RR((s?/usr/lib64/python2.7/Demo/tkinter/matt/canvas-moving-w-mouse.pyt
mouseLeavesc	Cs�t|ddddd|j�|_|jjdtdt�t|dd	d
d	�|_|jjdt�|jjdddddd
dd�}|jj	|d|j
�|jj	|d|j�tj
|jd|j�tj
|jd|j�dS(NttexttQUITt
foregroundRtcommandtsideR
twidtht5itheightiitgreenttagstselecteds<Any-Enter>s<Any-Leave>s<1>s<B1-Motion>(tButtontquitRtpacktLEFTtBOTHtCanvasR	tcreate_ovalttag_bindRRtWidgettbindRR(Rtfred((s?/usr/lib64/python2.7/Demo/tkinter/matt/canvas-moving-w-mouse.pyt
createWidgets!scCs+tj||�tj|�|j�dS(N(tFramet__init__tPacktconfigR)(Rtmaster((s?/usr/lib64/python2.7/Demo/tkinter/matt/canvas-moving-w-mouse.pyR+1s
N(	t__name__t
__module__RRRRR)tNoneR+(((s?/usr/lib64/python2.7/Demo/tkinter/matt/canvas-moving-w-mouse.pyRs						N(tTkinterR*Rttesttmainloop(((s?/usr/lib64/python2.7/Demo/tkinter/matt/canvas-moving-w-mouse.pyt<module>s
1	PK�
Q\�j�HHmatt/radiobutton-simple.pyonu�[����
��^c@s7ddlTdefd��YZe�Zej�dS(i����(t*tTestcBs&eZd�Zd�Zdd�ZRS(cCs	dGHdS(Nthi((tself((s</usr/lib64/python2.7/Demo/tkinter/matt/radiobutton-simple.pytprintitsc
Csvt�|_|jjd�t|�|_|jj�t|jddd|jdddt�|j_|jjjdt	�t|jddd|jdd	dt�|j_
|jj
jdt	�t|jdd
d|jdddt�|j_|jjjdt	�t|d|j�|_
|j
jdt	�t|dd
ddd|j�|_|jjdtdt�dS(Nt	chocolatettextsChocolate FlavortvariabletvaluetanchortfillsStrawberry Flavort
strawberrysLemon FlavortlemonttextvariabletQUITt
foregroundtredtcommandtside(t	StringVartflavortsettFramet
radioframetpacktRadiobuttontWtchoctXtstrawRtEntrytentrytButtontquitRtBOTTOMtBOTH(R((s</usr/lib64/python2.7/Demo/tkinter/matt/radiobutton-simple.pyt
createWidgetss0
cCs+tj||�tj|�|j�dS(N(Rt__init__tPacktconfigR$(Rtmaster((s</usr/lib64/python2.7/Demo/tkinter/matt/radiobutton-simple.pyR%7s
N(t__name__t
__module__RR$tNoneR%(((s</usr/lib64/python2.7/Demo/tkinter/matt/radiobutton-simple.pyR
s		&N(tTkinterRRttesttmainloop(((s</usr/lib64/python2.7/Demo/tkinter/matt/radiobutton-simple.pyt<module>s
/	PK�
Q\4+���matt/two-radio-groups.pycnu�[����
��^c@s�ddlTd�Zd�Zd�Ze�Zeededd�Zej	de
�e�Ze
�Zee�Zee�Zejee�eed	d
ddd
e�Zej	de�ejd�ejd�ej�dS(i����(t*cCs�ttdddd�}|jdtdd�t|�|_|jjdd	d
|dd�|jjd
idd6|d
6dd6�|jjd
idd6|d
6dd6�|jd�|j|d<|S(NttextsPolitical Partyt	underlineitsidetpadxt2mtlabelt
RepublicantvariabletvalueitradiobuttontDemocratitLibertarianitmenu(	t
MenubuttontmBartpacktLEFTtMenuR
tadd_radiobuttontaddtset(tvartRadiobutton_button((s:/usr/lib64/python2.7/Demo/tkinter/matt/two-radio-groups.pytmakePoliticalPartiess	


cCs�ttdddd�}|jdtdd�t|�|_|jjdd	d
|dd	�|jjddd
|dd�|jjdd
d
|dd
�|jd�|j|d<|S(NRtFlavorsRiRRRRt
StrawberryRR	t	Chocolates
Rocky RoadR
(RRRRRR
RR(RR((s:/usr/lib64/python2.7/Demo/tkinter/matt/two-radio-groups.pytmakeFlavors2s	




cCs#dGtj�GHdGtj�GHHdS(Nsparty iss	flavor is(tpartytgettflavor(((s:/usr/lib64/python2.7/Demo/tkinter/matt/two-radio-groups.pyt
printStuffMstrelieftborderwidthitfillRsprint party and flavort
foregroundtredtcommandRs	menu demoN(tTkinterRRR tTktroottFrametRAISEDRRtXtIntVarRt	StringVarRRtRadiobutton_button2t
tk_menuBartButtontbtTOPttitleticonnametmainloop(((s:/usr/lib64/python2.7/Demo/tkinter/matt/two-radio-groups.pyt<module>s"
							

PK�
Q\0L���matt/killing-window-w-wm.pycnu�[����
��^c@s@ddlTd�Zdefd��YZe�Zej�dS(i����(t*cCs	dGHdS(Nswhoops -- tried to delete me!((((s=/usr/lib64/python2.7/Demo/tkinter/matt/killing-window-w-wm.pytmy_delete_callback	stTestcBs&eZd�Zd�Zdd�ZRS(cCs
|GdGHdS(Ns3is now getting nuked. performing some save here....((tselftevent((s=/usr/lib64/python2.7/Demo/tkinter/matt/killing-window-w-wm.pytdeathHandler
scCs,t|dd�|_|jjdt�dS(NttexttHellotside(tButtonthi_theretpacktLEFT(R((s=/usr/lib64/python2.7/Demo/tkinter/matt/killing-window-w-wm.pyt
createWidgetsscCs>tj||�tj|�|j�|jd|j�dS(Ns	<Destroy>(tFramet__init__tPacktconfigR
tbind_allR(Rtmaster((s=/usr/lib64/python2.7/Demo/tkinter/matt/killing-window-w-wm.pyRs

N(t__name__t
__module__RR
tNoneR(((s=/usr/lib64/python2.7/Demo/tkinter/matt/killing-window-w-wm.pyRs		N(tTkinterRRRttesttmainloop(((s=/usr/lib64/python2.7/Demo/tkinter/matt/killing-window-w-wm.pyt<module>s
		PK�
Q\;mDD matt/canvas-reading-tag-info.pyonu�[����
��^c@s7ddlTdefd��YZe�Zej�dS(i����(t*tTestcBs&eZd�Zd�Zdd�ZRS(cCs	dGHdS(Nthi((tself((sA/usr/lib64/python2.7/Demo/tkinter/matt/canvas-reading-tag-info.pytprintitscCs!t|ddddd|j�|_|jjdtdt�t|dd	d
d	�|_|jjddddddddddd
d�}|jj	|d�}dG|dGdGH|jj	|d�}dG|dGdGHdG|dGdGH|jj	|d
�}dG|dGH|jjdt
�dS(NttexttQUITt
foregroundtredtcommandtsidetfilltwidtht5itheighti
inttagstweeetfootgrootstipples#pgon's current stipple value is -->is<--s pgon's current fill value is -->s   when he is usually colored -->ispgon's tags are(RRR(tButtontquitRtpacktBOTTOMtBOTHtCanvastdrawingtcreate_polygont
itemconfigtLEFT(Rtpgontoption_value((sA/usr/lib64/python2.7/Demo/tkinter/matt/canvas-reading-tag-info.pyt
createWidgetss	
cCs+tj||�tj|�|j�dS(N(tFramet__init__tPacktconfigR (Rtmaster((sA/usr/lib64/python2.7/Demo/tkinter/matt/canvas-reading-tag-info.pyR"*s
N(t__name__t
__module__RR tNoneR"(((sA/usr/lib64/python2.7/Demo/tkinter/matt/canvas-reading-tag-info.pyRs		"N(tTkinterR!Rttesttmainloop(((sA/usr/lib64/python2.7/Demo/tkinter/matt/canvas-reading-tag-info.pyt<module>s
+	PK�
Q\;U<��"matt/subclass-existing-widgets.pyonu�[����
��^c@sJddlTdefd��YZd�Ze�Zee�ej�dS(i����(t*t
New_ButtoncBseZd�ZRS(cCs|jGH|jd|_dS(Ni(tcounter(tself((sC/usr/lib64/python2.7/Demo/tkinter/matt/subclass-existing-widgets.pytcallbacks(t__name__t
__module__R(((sC/usr/lib64/python2.7/Demo/tkinter/matt/subclass-existing-widgets.pyRscCs�t|�}|j�t|ddddd|j�|_|jjdtdt�t|dd�|_|jj	d|jj
�|jjdt�d	|j_dS(
NttexttQUITt
foregroundtredtcommandtsidetfilltHelloi+(tFrametpacktButtontquitRtLEFTtBOTHRthi_theretconfigRR(ttoptf((sC/usr/lib64/python2.7/Demo/tkinter/matt/subclass-existing-widgets.pyt
createWidgetss
$N(tTkinterRRRtTktroottmainloop(((sC/usr/lib64/python2.7/Demo/tkinter/matt/subclass-existing-widgets.pyt<module>s

		
PK�
Q\������matt/animation-simple.pyonu�[����
��^c@s7ddlTdefd��YZe�Zej�dS(i����(t*tTestcBs/eZd�Zd�Zd�Zdd�ZRS(cCs	dGHdS(Nthi((tself((s:/usr/lib64/python2.7/Demo/tkinter/matt/animation-simple.pytprintitsc	Cs�t|ddddd|j�|_|jjdtdt�t|dd	d
d	�|_|jjddddd
ddd�|jjdt�dS(NttexttQUITt
foregroundtredtcommandtsidetfilltwidtht5itheightii
ttagstthingtblue(	tButtontquitRtpacktLEFTtBOTHtCanvastdrawtcreate_rectangle(R((s:/usr/lib64/python2.7/Demo/tkinter/matt/animation-simple.pyt
createWidgets	s%cGs-|jjddd�|jd|j�dS(NRs0.01ii
(Rtmovetaftert	moveThing(Rtargs((s:/usr/lib64/python2.7/Demo/tkinter/matt/animation-simple.pyRscCs>tj||�tj|�|j�|jd|j�dS(Ni
(tFramet__init__tPacktconfigRRR(Rtmaster((s:/usr/lib64/python2.7/Demo/tkinter/matt/animation-simple.pyR s

N(t__name__t
__module__RRRtNoneR (((s:/usr/lib64/python2.7/Demo/tkinter/matt/animation-simple.pyRs			N(tTkinterRRttesttmainloop(((s:/usr/lib64/python2.7/Demo/tkinter/matt/animation-simple.pyt<module>s
	PK�
Q\���*hh#matt/entry-with-shared-variable.pycnu�[����
��^c@sSddlTddlZdefd��YZe�Zejjd�ej�dS(i����(t*NtAppcBs&eZdd�Zd�Zd�ZRS(cCs�tj||�|j�t|�|_|jj�t|ddd|j�|_|jj�t�|_	|j	j
d�|jjd|j	�|jjd|j
�dS(NttextsUppercase The Entrytcommandsthis is a variablettextvariables<Key-Return>(tFramet__init__tpacktEntrytentrythingytButtontuppertbuttont	StringVartcontentstsettconfigtbindtprint_contents(tselftmaster((sD/usr/lib64/python2.7/Demo/tkinter/matt/entry-with-shared-variable.pyRs


cCs,tj|jj��}|jj|�dS(N(tstringRRtgetR(Rtstr((sD/usr/lib64/python2.7/Demo/tkinter/matt/entry-with-shared-variable.pyR scCsdG|jj�GHdS(Ns"hi. contents of entry is now ---->(RR(Rtevent((sD/usr/lib64/python2.7/Demo/tkinter/matt/entry-with-shared-variable.pyR)sN(t__name__t
__module__tNoneRRR(((sD/usr/lib64/python2.7/Demo/tkinter/matt/entry-with-shared-variable.pyRs		tFoo(tTkinterRRRtrootRttitletmainloop(((sD/usr/lib64/python2.7/Demo/tkinter/matt/entry-with-shared-variable.pyt<module>s

&	PK�
Q\:���
�
matt/canvas-mult-item-sel.pycnu�[����
��^c@sCddlTdZdZdefd��YZe�Zej�dS(i����(t*tredtbluetTestcBs8eZd�Zd�Zd�Zd�Zdd�ZRS(cCs�|jjt�s;|jjddt�|jjd�n,|jjddt�|jjddt�|j	|_
|j|_dS(Ntselectedtfilltwithtag(
twidgettfind_withtagtCURRENTtdrawt
itemconfigtUNSELECTED_COLORtdtagtaddtagtSELECTED_COLORtxtlastxtytlasty(tselftevent((s>/usr/lib64/python2.7/Demo/tkinter/matt/canvas-mult-item-sel.pyt	mouseDownscCsF|jjd|j|j|j|j�|j|_|j|_dS(NR(R
tmoveRRRR(RR((s>/usr/lib64/python2.7/Demo/tkinter/matt/canvas-mult-item-sel.pyt	mouseMove!s*c	CsA|jjdddddtdt�}|jjddt�dS(NiiRttagsRR(R
tcreate_ovalRR	R(Rtfred((s>/usr/lib64/python2.7/Demo/tkinter/matt/canvas-mult-item-sel.pyt
makeNewDot&scCs(t|ddddd|j�|_t|dddd�|_tj|jd	|j�tj|jd
|j�t|ddddd|j	�|_
d
ttf}t
|ddd|�|_|jjdtdt�|jjdtdtdd�|j
jdtdt�|jjdt�dS(NttexttQUITt
foregroundRtcommandtwidtht5itheights<1>s<B1-Motion>smake a new dotRs�%s dots are selected and can be dragged.
%s are not selected.
Click in a dot to select it.
Click on empty space to deselect all dots.tsideRtexpandi(tButtontquitRtCanvasR
tWidgettbindRRRtbuttonRRtMessagetlabeltpacktBOTTOMtBOTHtXtLEFT(Rtmessage((s>/usr/lib64/python2.7/Demo/tkinter/matt/canvas-mult-item-sel.pyt
createWidgets-s
cCs+tj||�tj|�|j�dS(N(tFramet__init__tPacktconfigR4(Rtmaster((s>/usr/lib64/python2.7/Demo/tkinter/matt/canvas-mult-item-sel.pyR6Hs
N(t__name__t
__module__RRRR4tNoneR6(((s>/usr/lib64/python2.7/Demo/tkinter/matt/canvas-mult-item-sel.pyRs
				N(tTkinterRRR5Rttesttmainloop(((s>/usr/lib64/python2.7/Demo/tkinter/matt/canvas-mult-item-sel.pyt<module>s

E	PK�
Q\|=4�>>matt/canvas-with-scrollbars.pynu�[���from Tkinter import *

# This example program creates a scrolling canvas, and demonstrates
# how to tie scrollbars and canvases together. The mechanism
# is analogus for listboxes and other widgets with
# "xscroll" and "yscroll" configuration options.

class Test(Frame):
    def printit(self):
        print "hi"

    def createWidgets(self):
        self.question = Label(self, text="Can Find The BLUE Square??????")
        self.question.pack()

        self.QUIT = Button(self, text='QUIT', background='red',
                           height=3, command=self.quit)
        self.QUIT.pack(side=BOTTOM, fill=BOTH)
        spacer = Frame(self, height="0.25i")
        spacer.pack(side=BOTTOM)

        # notice that the scroll region (20" x 20") is larger than
        # displayed size of the widget (5" x 5")
        self.draw = Canvas(self, width="5i", height="5i",
                           background="white",
                           scrollregion=(0, 0, "20i", "20i"))

        self.draw.scrollX = Scrollbar(self, orient=HORIZONTAL)
        self.draw.scrollY = Scrollbar(self, orient=VERTICAL)

        # now tie the three together. This is standard boilerplate text
        self.draw['xscrollcommand'] = self.draw.scrollX.set
        self.draw['yscrollcommand'] = self.draw.scrollY.set
        self.draw.scrollX['command'] = self.draw.xview
        self.draw.scrollY['command'] = self.draw.yview

        # draw something. Note that the first square
        # is visible, but you need to scroll to see the second one.
        self.draw.create_rectangle(0, 0, "3.5i", "3.5i", fill="black")
        self.draw.create_rectangle("10i", "10i", "13.5i", "13.5i", fill="blue")

        # pack 'em up
        self.draw.scrollX.pack(side=BOTTOM, fill=X)
        self.draw.scrollY.pack(side=RIGHT, fill=Y)
        self.draw.pack(side=LEFT)


    def scrollCanvasX(self, *args):
        print "scrolling", args
        print self.draw.scrollX.get()


    def __init__(self, master=None):
        Frame.__init__(self, master)
        Pack.config(self)
        self.createWidgets()

test = Test()

test.mainloop()
PK�
Q\������matt/animation-simple.pycnu�[����
��^c@s7ddlTdefd��YZe�Zej�dS(i����(t*tTestcBs/eZd�Zd�Zd�Zdd�ZRS(cCs	dGHdS(Nthi((tself((s:/usr/lib64/python2.7/Demo/tkinter/matt/animation-simple.pytprintitsc	Cs�t|ddddd|j�|_|jjdtdt�t|dd	d
d	�|_|jjddddd
ddd�|jjdt�dS(NttexttQUITt
foregroundtredtcommandtsidetfilltwidtht5itheightii
ttagstthingtblue(	tButtontquitRtpacktLEFTtBOTHtCanvastdrawtcreate_rectangle(R((s:/usr/lib64/python2.7/Demo/tkinter/matt/animation-simple.pyt
createWidgets	s%cGs-|jjddd�|jd|j�dS(NRs0.01ii
(Rtmovetaftert	moveThing(Rtargs((s:/usr/lib64/python2.7/Demo/tkinter/matt/animation-simple.pyRscCs>tj||�tj|�|j�|jd|j�dS(Ni
(tFramet__init__tPacktconfigRRR(Rtmaster((s:/usr/lib64/python2.7/Demo/tkinter/matt/animation-simple.pyR s

N(t__name__t
__module__RRRtNoneR (((s:/usr/lib64/python2.7/Demo/tkinter/matt/animation-simple.pyRs			N(tTkinterRRttesttmainloop(((s:/usr/lib64/python2.7/Demo/tkinter/matt/animation-simple.pyt<module>s
	PK�
Q\;U<��"matt/subclass-existing-widgets.pycnu�[����
��^c@sJddlTdefd��YZd�Ze�Zee�ej�dS(i����(t*t
New_ButtoncBseZd�ZRS(cCs|jGH|jd|_dS(Ni(tcounter(tself((sC/usr/lib64/python2.7/Demo/tkinter/matt/subclass-existing-widgets.pytcallbacks(t__name__t
__module__R(((sC/usr/lib64/python2.7/Demo/tkinter/matt/subclass-existing-widgets.pyRscCs�t|�}|j�t|ddddd|j�|_|jjdtdt�t|dd�|_|jj	d|jj
�|jjdt�d	|j_dS(
NttexttQUITt
foregroundtredtcommandtsidetfilltHelloi+(tFrametpacktButtontquitRtLEFTtBOTHRthi_theretconfigRR(ttoptf((sC/usr/lib64/python2.7/Demo/tkinter/matt/subclass-existing-widgets.pyt
createWidgetss
$N(tTkinterRRRtTktroottmainloop(((sC/usr/lib64/python2.7/Demo/tkinter/matt/subclass-existing-widgets.pyt<module>s

		
PK�
Q\�̆^#matt/not-what-you-might-think-1.pycnu�[����
��^c@sWddlTdefd��YZe�Zejjd�ejjd�ej�dS(i����(t*tTestcBseZd�Zdd�ZRS(cCsxt|dddddd�|_|jjdt�t|jddd	d
d|j�|j_|jjjdt�dS(Ntwidtht1itheightt
backgroundtgreentsidettexttQUITt
foregroundtredtcommand(tFrametGpaneltpacktLEFTtButtontquitR	(tself((sD/usr/lib64/python2.7/Demo/tkinter/matt/not-what-you-might-think-1.pyt
createWidgetsscCs+tj||�tj|�|j�dS(N(R
t__init__tPacktconfigR(Rtmaster((sD/usr/lib64/python2.7/Demo/tkinter/matt/not-what-you-might-think-1.pyRs
N(t__name__t
__module__RtNoneR(((sD/usr/lib64/python2.7/Demo/tkinter/matt/not-what-you-might-think-1.pyRs	
spacker demotpackerN(tTkinterR
RttestRttitleticonnametmainloop(((sD/usr/lib64/python2.7/Demo/tkinter/matt/not-what-you-might-think-1.pyt<module>s

	PK�
Q\��t44matt/entry-simple.pycnu�[����
��^c@sSddlTddlZdefd��YZe�Zejjd�ej�dS(i����(t*NtAppcBseZdd�Zd�ZRS(cCsMtj||�|j�t�|_|jj�|jjd|j�dS(Ns<Key-Return>(tFramet__init__tpacktEntrytentrythingytbindtprint_contents(tselftmaster((s6/usr/lib64/python2.7/Demo/tkinter/matt/entry-simple.pyRs


cCsdG|jj�GHdS(Ns"hi. contents of entry is now ---->(Rtget(R	tevent((s6/usr/lib64/python2.7/Demo/tkinter/matt/entry-simple.pyRsN(t__name__t
__module__tNoneRR(((s6/usr/lib64/python2.7/Demo/tkinter/matt/entry-simple.pyRstFoo(tTkintertstringRRtrootR
ttitletmainloop(((s6/usr/lib64/python2.7/Demo/tkinter/matt/entry-simple.pyt<module>s

	PK�
Q\#U����matt/entry-simple.pynu�[���from Tkinter import *
import string

# This program  shows how to use a simple type-in box

class App(Frame):
    def __init__(self, master=None):
        Frame.__init__(self, master)
        self.pack()

        self.entrythingy = Entry()
        self.entrythingy.pack()

        # and here we get a callback when the user hits return. we could
        # make the key that triggers the callback anything we wanted to.
        # other typical options might be <Key-Tab> or <Key> (for anything)
        self.entrythingy.bind('<Key-Return>', self.print_contents)

    def print_contents(self, event):
        print "hi. contents of entry is now ---->", self.entrythingy.get()

root = App()
root.master.title("Foo")
root.mainloop()
PK�
Q\e��̍�matt/canvas-demo-simple.pycnu�[����
��^c@s7ddlTdefd��YZe�Zej�dS(i����(t*tTestcBs&eZd�Zd�Zdd�ZRS(cCs	dGHdS(Nthi((tself((s</usr/lib64/python2.7/Demo/tkinter/matt/canvas-demo-simple.pytprintitscCs�t|ddddd|j�|_|jjdtdt�t|dd	d
d	�|_|jjdddddd
�|jjdt	�dS(NttexttQUITt
foregroundtredtcommandtsidetfilltwidtht5itheightit3itblack(
tButtontquitRtpacktBOTTOMtBOTHtCanvastdrawtcreate_rectangletLEFT(R((s</usr/lib64/python2.7/Demo/tkinter/matt/canvas-demo-simple.pyt
createWidgets	scCs+tj||�tj|�|j�dS(N(tFramet__init__tPacktconfigR(Rtmaster((s</usr/lib64/python2.7/Demo/tkinter/matt/canvas-demo-simple.pyRs
N(t__name__t
__module__RRtNoneR(((s</usr/lib64/python2.7/Demo/tkinter/matt/canvas-demo-simple.pyRs		N(tTkinterRRttesttmainloop(((s</usr/lib64/python2.7/Demo/tkinter/matt/canvas-demo-simple.pyt<module>s
	PK�
Q\�F�77#matt/not-what-you-might-think-2.pycnu�[����
��^c@sWddlTdefd��YZe�Zejjd�ejjd�ej�dS(i����(t*tTestcBseZd�Zdd�ZRS(cCs�t|dddddd�|_|jjd�|jjdt�t|jdd	d
dd|j�|j_|jjjdt�dS(
Ntwidtht1itheightt
backgroundtgreenitsidettexttQUITt
foregroundtredtcommand(tFrametGpanelt	propagatetpacktLEFTtButtontquitR	(tself((sD/usr/lib64/python2.7/Demo/tkinter/matt/not-what-you-might-think-2.pyt
createWidgetsscCs+tj||�tj|�|j�dS(N(R
t__init__tPacktconfigR(Rtmaster((sD/usr/lib64/python2.7/Demo/tkinter/matt/not-what-you-might-think-2.pyRs
N(t__name__t
__module__RtNoneR(((sD/usr/lib64/python2.7/Demo/tkinter/matt/not-what-you-might-think-2.pyRs	spacker demotpackerN(tTkinterR
RttestRttitleticonnametmainloop(((sD/usr/lib64/python2.7/Demo/tkinter/matt/not-what-you-might-think-2.pyt<module>s

	PK�
Q\�3�--"matt/window-creation-w-location.pynu�[���from Tkinter import *

import sys
##sys.path.append("/users/mjc4y/projects/python/tkinter/utils")
##from TkinterUtils  import *

# this shows how to create a new window with a button in it that
# can create new windows

class QuitButton(Button):
    def __init__(self, master, *args, **kwargs):
        if not kwargs.has_key("text"):
            kwargs["text"] = "QUIT"
        if not kwargs.has_key("command"):
            kwargs["command"] = master.quit
        apply(Button.__init__, (self, master) + args, kwargs)

class Test(Frame):
    def makeWindow(self, *args):
        fred = Toplevel()

        fred.label = Canvas (fred, width="2i", height="2i")

        fred.label.create_line("0", "0", "2i", "2i")
        fred.label.create_line("0", "2i", "2i", "0")
        fred.label.pack()

        ##centerWindow(fred, self.master)

    def createWidgets(self):
        self.QUIT = QuitButton(self)
        self.QUIT.pack(side=LEFT, fill=BOTH)

        self.makeWindow = Button(self, text='Make a New Window',
                                 width=50, height=20,
                                 command=self.makeWindow)
        self.makeWindow.pack(side=LEFT)

    def __init__(self, master=None):
        Frame.__init__(self, master)
        Pack.config(self)
        self.createWidgets()

test = Test()
test.mainloop()
PK�
Q\:���
�
matt/canvas-mult-item-sel.pyonu�[����
��^c@sCddlTdZdZdefd��YZe�Zej�dS(i����(t*tredtbluetTestcBs8eZd�Zd�Zd�Zd�Zdd�ZRS(cCs�|jjt�s;|jjddt�|jjd�n,|jjddt�|jjddt�|j	|_
|j|_dS(Ntselectedtfilltwithtag(
twidgettfind_withtagtCURRENTtdrawt
itemconfigtUNSELECTED_COLORtdtagtaddtagtSELECTED_COLORtxtlastxtytlasty(tselftevent((s>/usr/lib64/python2.7/Demo/tkinter/matt/canvas-mult-item-sel.pyt	mouseDownscCsF|jjd|j|j|j|j�|j|_|j|_dS(NR(R
tmoveRRRR(RR((s>/usr/lib64/python2.7/Demo/tkinter/matt/canvas-mult-item-sel.pyt	mouseMove!s*c	CsA|jjdddddtdt�}|jjddt�dS(NiiRttagsRR(R
tcreate_ovalRR	R(Rtfred((s>/usr/lib64/python2.7/Demo/tkinter/matt/canvas-mult-item-sel.pyt
makeNewDot&scCs(t|ddddd|j�|_t|dddd�|_tj|jd	|j�tj|jd
|j�t|ddddd|j	�|_
d
ttf}t
|ddd|�|_|jjdtdt�|jjdtdtdd�|j
jdtdt�|jjdt�dS(NttexttQUITt
foregroundRtcommandtwidtht5itheights<1>s<B1-Motion>smake a new dotRs�%s dots are selected and can be dragged.
%s are not selected.
Click in a dot to select it.
Click on empty space to deselect all dots.tsideRtexpandi(tButtontquitRtCanvasR
tWidgettbindRRRtbuttonRRtMessagetlabeltpacktBOTTOMtBOTHtXtLEFT(Rtmessage((s>/usr/lib64/python2.7/Demo/tkinter/matt/canvas-mult-item-sel.pyt
createWidgets-s
cCs+tj||�tj|�|j�dS(N(tFramet__init__tPacktconfigR4(Rtmaster((s>/usr/lib64/python2.7/Demo/tkinter/matt/canvas-mult-item-sel.pyR6Hs
N(t__name__t
__module__RRRR4tNoneR6(((s>/usr/lib64/python2.7/Demo/tkinter/matt/canvas-mult-item-sel.pyRs
				N(tTkinterRRR5Rttesttmainloop(((s>/usr/lib64/python2.7/Demo/tkinter/matt/canvas-mult-item-sel.pyt<module>s

E	PK�
Q\�F�77#matt/not-what-you-might-think-2.pyonu�[����
��^c@sWddlTdefd��YZe�Zejjd�ejjd�ej�dS(i����(t*tTestcBseZd�Zdd�ZRS(cCs�t|dddddd�|_|jjd�|jjdt�t|jdd	d
dd|j�|j_|jjjdt�dS(
Ntwidtht1itheightt
backgroundtgreenitsidettexttQUITt
foregroundtredtcommand(tFrametGpanelt	propagatetpacktLEFTtButtontquitR	(tself((sD/usr/lib64/python2.7/Demo/tkinter/matt/not-what-you-might-think-2.pyt
createWidgetsscCs+tj||�tj|�|j�dS(N(R
t__init__tPacktconfigR(Rtmaster((sD/usr/lib64/python2.7/Demo/tkinter/matt/not-what-you-might-think-2.pyRs
N(t__name__t
__module__RtNoneR(((sD/usr/lib64/python2.7/Demo/tkinter/matt/not-what-you-might-think-2.pyRs	spacker demotpackerN(tTkinterR
RttestRttitleticonnametmainloop(((sD/usr/lib64/python2.7/Demo/tkinter/matt/not-what-you-might-think-2.pyt<module>s

	PK�
Q\ʥ�E��"matt/not-what-you-might-think-1.pynu�[���from Tkinter import *


class Test(Frame):
    def createWidgets(self):

        self.Gpanel = Frame(self, width='1i', height='1i',
                            background='green')
        self.Gpanel.pack(side=LEFT)

        # a QUIT button
        self.Gpanel.QUIT = Button(self.Gpanel, text='QUIT',
                                  foreground='red',
                                  command=self.quit)
        self.Gpanel.QUIT.pack(side=LEFT)


    def __init__(self, master=None):
        Frame.__init__(self, master)
        Pack.config(self)
        self.createWidgets()

test = Test()

test.master.title('packer demo')
test.master.iconname('packer')

test.mainloop()
PK�
Q\�Q.�matt/killing-window-w-wm.pynu�[���from Tkinter import *

# This file shows how to trap the killing of a window
# when the user uses window manager menus (typ. upper left hand corner
# menu in the decoration border).


### ******* this isn't really called -- read the comments
def my_delete_callback():
    print "whoops -- tried to delete me!"

class Test(Frame):
    def deathHandler(self, event):
        print self, "is now getting nuked. performing some save here...."

    def createWidgets(self):
        # a hello button
        self.hi_there = Button(self, text='Hello')
        self.hi_there.pack(side=LEFT)

    def __init__(self, master=None):
        Frame.__init__(self, master)
        Pack.config(self)
        self.createWidgets()

        ###
        ###  PREVENT WM kills from happening
        ###

        # the docs would have you do this:

#       self.master.protocol("WM_DELETE_WINDOW", my_delete_callback)

        # unfortunately, some window managers will not send this request to a window.
        # the "protocol" function seems incapable of trapping these "aggressive" window kills.
        # this line of code catches everything, tho. The window is deleted, but you have a chance
        # of cleaning up first.
        self.bind_all("<Destroy>", self.deathHandler)


test = Test()
test.mainloop()
PK�
Q\	����matt/slider-demo-1.pycnu�[����
��^c@s7ddlTdefd��YZe�Zej�dS(i����(t*tTestcBs/eZd�Zd�Zd�Zdd�ZRS(cCs
dG|GHdS(Ns
slider now at((tselftval((s7/usr/lib64/python2.7/Demo/tkinter/matt/slider-demo-1.pytprint_valuescCs|jjd�dS(Ni(tslidertset(R((s7/usr/lib64/python2.7/Demo/tkinter/matt/slider-demo-1.pytreset
scCs�t|dddddtdddd	d
|j�|_t|ddd
|j�|_t|dd
ddd
|j�|_|jjdt	�|jjdt	�|jjdt	dt
�dS(Ntfrom_ittoidtorienttlengtht3itlabelshappy slidertcommandttextsreset slidertQUITt
foregroundtredtsidetfill(tScalet
HORIZONTALRRtButtonRtquitRtpacktLEFTtBOTH(R((s7/usr/lib64/python2.7/Demo/tkinter/matt/slider-demo-1.pyt
createWidgets
scCs+tj||�tj|�|j�dS(N(tFramet__init__tPacktconfigR(Rtmaster((s7/usr/lib64/python2.7/Demo/tkinter/matt/slider-demo-1.pyRs
N(t__name__t
__module__RRRtNoneR(((s7/usr/lib64/python2.7/Demo/tkinter/matt/slider-demo-1.pyRs			N(tTkinterRRttesttmainloop(((s7/usr/lib64/python2.7/Demo/tkinter/matt/slider-demo-1.pyt<module>s
	PK�
Q\���d�� matt/canvas-w-widget-draw-el.pyonu�[����
��^c@s7ddlTdefd��YZe�Zej�dS(i����(t*tTestcBs&eZd�Zd�Zdd�ZRS(cCs	dGHdS(Nthi((tself((sA/usr/lib64/python2.7/Demo/tkinter/matt/canvas-w-widget-draw-el.pytprinthiscCs�t|ddddd|j�|_|jjdtdt�t|dd	d
d	�|_t|ddd|j�|_	|jj
ddd
|j	�|jjdt�dS(NttexttQUITt
foregroundtredtcommandtsidetfilltwidtht5itheightsthis is a buttoni,twindow(tButtontquitRtpacktBOTTOMtBOTHtCanvastdrawRtbuttont
create_windowtLEFT(R((sA/usr/lib64/python2.7/Demo/tkinter/matt/canvas-w-widget-draw-el.pyt
createWidgets	scCs+tj||�tj|�|j�dS(N(tFramet__init__tPacktconfigR(Rtmaster((sA/usr/lib64/python2.7/Demo/tkinter/matt/canvas-w-widget-draw-el.pyRs
N(t__name__t
__module__RRtNoneR(((sA/usr/lib64/python2.7/Demo/tkinter/matt/canvas-w-widget-draw-el.pyRs		N(tTkinterRRttesttmainloop(((sA/usr/lib64/python2.7/Demo/tkinter/matt/canvas-w-widget-draw-el.pyt<module>s
	PK�
Q\�;���matt/window-creation-more.pynu�[���from Tkinter import *

# this shows how to create a new window with a button in it
# that can create new windows

class Test(Frame):
    def printit(self):
        print "hi"

    def makeWindow(self):
        fred = Toplevel()
        fred.label = Button(fred,
                            text="This is window number %d." % self.windownum,
                            command=self.makeWindow)
        fred.label.pack()
        self.windownum = self.windownum + 1

    def createWidgets(self):
        self.QUIT = Button(self, text='QUIT', foreground='red',
                           command=self.quit)
        self.QUIT.pack(side=LEFT, fill=BOTH)

        # a hello button
        self.hi_there = Button(self, text='Make a New Window',
                               command=self.makeWindow)
        self.hi_there.pack(side=LEFT)

    def __init__(self, master=None):
        Frame.__init__(self, master)
        Pack.config(self)
        self.windownum = 0
        self.createWidgets()

test = Test()
test.mainloop()
PK�
Q\L�

!matt/printing-coords-of-items.pycnu�[����
��^c@s7ddlTdefd��YZe�Zej�dS(i����(t*tTestcBsAeZd�Zd�Zd�Zd�Zd�Zdd�ZRS(cCs�|jjt�s�|jj|jd|jd|jd|jddd�}|jj|d|j�|jj|d|j	�n|j|_
|j|_dS(Ni
tfilltgreens<Enter>s<Leave>(twidgettfind_withtagtCURRENTtdrawtcreate_ovaltxtyttag_bindt
mouseEntert
mouseLeavetlastxtlasty(tselfteventtfred((sB/usr/lib64/python2.7/Demo/tkinter/matt/printing-coords-of-items.pyt	mouseDown	s	+	cCsF|jjt|j|j|j|j�|j|_|j|_dS(N(RtmoveRR	RR
R(RR((sB/usr/lib64/python2.7/Demo/tkinter/matt/printing-coords-of-items.pyt	mouseMoves*cCs+|jjtdd�|jjt�GHdS(NRtred(Rt
itemconfigRtcoords(RR((sB/usr/lib64/python2.7/Demo/tkinter/matt/printing-coords-of-items.pyR"scCs|jjtdd�dS(NRtblue(RRR(RR((sB/usr/lib64/python2.7/Demo/tkinter/matt/printing-coords-of-items.pyR
(scCs�t|ddddd|j�|_|jjdtdt�t|dd	d
d	�|_|jjdt�tj	|jd|j
�tj	|jd|j�dS(
NttexttQUITt
foregroundRtcommandtsideRtwidtht5itheights<1>s<B1-Motion>(tButtontquitRtpacktLEFTtBOTHtCanvasRtWidgettbindRR(R((sB/usr/lib64/python2.7/Demo/tkinter/matt/printing-coords-of-items.pyt
createWidgets-scCs+tj||�tj|�|j�dS(N(tFramet__init__tPacktconfigR*(Rtmaster((sB/usr/lib64/python2.7/Demo/tkinter/matt/printing-coords-of-items.pyR,7s
N(	t__name__t
__module__RRRR
R*tNoneR,(((sB/usr/lib64/python2.7/Demo/tkinter/matt/printing-coords-of-items.pyRs					
N(tTkinterR+Rttesttmainloop(((sB/usr/lib64/python2.7/Demo/tkinter/matt/printing-coords-of-items.pyt<module>s
7	PK�
Q\4+���matt/two-radio-groups.pyonu�[����
��^c@s�ddlTd�Zd�Zd�Ze�Zeededd�Zej	de
�e�Ze
�Zee�Zee�Zejee�eed	d
ddd
e�Zej	de�ejd�ejd�ej�dS(i����(t*cCs�ttdddd�}|jdtdd�t|�|_|jjdd	d
|dd�|jjd
idd6|d
6dd6�|jjd
idd6|d
6dd6�|jd�|j|d<|S(NttextsPolitical Partyt	underlineitsidetpadxt2mtlabelt
RepublicantvariabletvalueitradiobuttontDemocratitLibertarianitmenu(	t
MenubuttontmBartpacktLEFTtMenuR
tadd_radiobuttontaddtset(tvartRadiobutton_button((s:/usr/lib64/python2.7/Demo/tkinter/matt/two-radio-groups.pytmakePoliticalPartiess	


cCs�ttdddd�}|jdtdd�t|�|_|jjdd	d
|dd	�|jjddd
|dd�|jjdd
d
|dd
�|jd�|j|d<|S(NRtFlavorsRiRRRRt
StrawberryRR	t	Chocolates
Rocky RoadR
(RRRRRR
RR(RR((s:/usr/lib64/python2.7/Demo/tkinter/matt/two-radio-groups.pytmakeFlavors2s	




cCs#dGtj�GHdGtj�GHHdS(Nsparty iss	flavor is(tpartytgettflavor(((s:/usr/lib64/python2.7/Demo/tkinter/matt/two-radio-groups.pyt
printStuffMstrelieftborderwidthitfillRsprint party and flavort
foregroundtredtcommandRs	menu demoN(tTkinterRRR tTktroottFrametRAISEDRRtXtIntVarRt	StringVarRRtRadiobutton_button2t
tk_menuBartButtontbtTOPttitleticonnametmainloop(((s:/usr/lib64/python2.7/Demo/tkinter/matt/two-radio-groups.pyt<module>s"
							

PK�
Q\0L���matt/killing-window-w-wm.pyonu�[����
��^c@s@ddlTd�Zdefd��YZe�Zej�dS(i����(t*cCs	dGHdS(Nswhoops -- tried to delete me!((((s=/usr/lib64/python2.7/Demo/tkinter/matt/killing-window-w-wm.pytmy_delete_callback	stTestcBs&eZd�Zd�Zdd�ZRS(cCs
|GdGHdS(Ns3is now getting nuked. performing some save here....((tselftevent((s=/usr/lib64/python2.7/Demo/tkinter/matt/killing-window-w-wm.pytdeathHandler
scCs,t|dd�|_|jjdt�dS(NttexttHellotside(tButtonthi_theretpacktLEFT(R((s=/usr/lib64/python2.7/Demo/tkinter/matt/killing-window-w-wm.pyt
createWidgetsscCs>tj||�tj|�|j�|jd|j�dS(Ns	<Destroy>(tFramet__init__tPacktconfigR
tbind_allR(Rtmaster((s=/usr/lib64/python2.7/Demo/tkinter/matt/killing-window-w-wm.pyRs

N(t__name__t
__module__RR
tNoneR(((s=/usr/lib64/python2.7/Demo/tkinter/matt/killing-window-w-wm.pyRs		N(tTkinterRRRttesttmainloop(((s=/usr/lib64/python2.7/Demo/tkinter/matt/killing-window-w-wm.pyt<module>s
		PK�
Q\�j�HHmatt/radiobutton-simple.pycnu�[����
��^c@s7ddlTdefd��YZe�Zej�dS(i����(t*tTestcBs&eZd�Zd�Zdd�ZRS(cCs	dGHdS(Nthi((tself((s</usr/lib64/python2.7/Demo/tkinter/matt/radiobutton-simple.pytprintitsc
Csvt�|_|jjd�t|�|_|jj�t|jddd|jdddt�|j_|jjjdt	�t|jddd|jdd	dt�|j_
|jj
jdt	�t|jdd
d|jdddt�|j_|jjjdt	�t|d|j�|_
|j
jdt	�t|dd
ddd|j�|_|jjdtdt�dS(Nt	chocolatettextsChocolate FlavortvariabletvaluetanchortfillsStrawberry Flavort
strawberrysLemon FlavortlemonttextvariabletQUITt
foregroundtredtcommandtside(t	StringVartflavortsettFramet
radioframetpacktRadiobuttontWtchoctXtstrawRtEntrytentrytButtontquitRtBOTTOMtBOTH(R((s</usr/lib64/python2.7/Demo/tkinter/matt/radiobutton-simple.pyt
createWidgetss0
cCs+tj||�tj|�|j�dS(N(Rt__init__tPacktconfigR$(Rtmaster((s</usr/lib64/python2.7/Demo/tkinter/matt/radiobutton-simple.pyR%7s
N(t__name__t
__module__RR$tNoneR%(((s</usr/lib64/python2.7/Demo/tkinter/matt/radiobutton-simple.pyR
s		&N(tTkinterRRttesttmainloop(((s</usr/lib64/python2.7/Demo/tkinter/matt/radiobutton-simple.pyt<module>s
/	PK�
Q\k�����matt/dialog-box.pycnu�[����
��^c@sGddlTddlmZdefd��YZe�Zej�dS(i����(t*(tDialogtTestcBs/eZd�Zd�Zd�Zdd�ZRS(cCs	dGHdS(Nthi((tself((s4/usr/lib64/python2.7/Demo/tkinter/matt/dialog-box.pytprintitsc
Cs1t|ddddddddd	d�}|jS(
s�Create a top-level dialog with some buttons.

        This uses the Dialog class, which is a wrapper around the Tcl/Tk
        tk_dialog script.  The function returns 0 if the user clicks 'yes'
        or 1 if the user clicks 'no'.
        ttitlesfred the dialog boxttextsclick on a choicetbitmaptinfotdefaultitstringstyestno(RR
(Rtnum(Rtd((s4/usr/lib64/python2.7/Demo/tkinter/matt/dialog-box.pyt
makeWindows	cCsrt|ddddd|j�|_|jjdtdt�t|ddd|j�|_|jjdt�dS(	NRtQUITt
foregroundtredtcommandtsidetfillsMake a New Window(tButtontquitRtpacktLEFTtBOTHRthi_there(R((s4/usr/lib64/python2.7/Demo/tkinter/matt/dialog-box.pyt
createWidgets.scCs4tj||�tj|�d|_|j�dS(Ni(tFramet__init__tPacktconfigt	windownumR(Rtmaster((s4/usr/lib64/python2.7/Demo/tkinter/matt/dialog-box.pyR9s
	N(t__name__t
__module__RRRtNoneR(((s4/usr/lib64/python2.7/Demo/tkinter/matt/dialog-box.pyRs		#	N(tTkinterRRRttesttmainloop(((s4/usr/lib64/python2.7/Demo/tkinter/matt/dialog-box.pyt<module>s
8	PK�
Q\��Vkk"matt/menu-all-types-of-entries.pyonu�[����
��^c@sddlTd�Zd�Zd�Zdad�Zd�Zd�Zd	�Zd
�Z	d�Z
e�Ze
eded
d�Zejde�e�Ze�Ze�Ze	�Ze
�Zejeeeee�ejd�ejd�ej�dS(i����(t*cCs	dGHdS(Nsopening new file((((sC/usr/lib64/python2.7/Demo/tkinter/matt/menu-all-types-of-entries.pytnew_file%scCs	dGHdS(Nsopening OLD file((((sC/usr/lib64/python2.7/Demo/tkinter/matt/menu-all-types-of-entries.pyt	open_file(scCs	dGHdS(Nspicked a menu item((((sC/usr/lib64/python2.7/Demo/tkinter/matt/menu-all-types-of-entries.pytprint_something+sicCstadGtGHdS(Ns
anchovies?(t	anchovies(((sC/usr/lib64/python2.7/Demo/tkinter/matt/menu-all-types-of-entries.pytprint_anchovies2scCs+ttdddd�}|jdtdd�t|�|_|jjdd	�|jjdd
t�|jjdddddt	�|jjdd
dddt
�|jjdddddddt�|jjdd�|jjd�|jjddddddddd|j
�|j|d<|S(NttextsSimple Button Commandst	underlineitsidetpadxt2mtlabeltUndotstatesNew...tcommandsOpen...sDifferent Fonttfonts&-*-helvetica-*-r-*-*-*-180-*-*-*-*-*-*tbitmaptinfot	separatortQuitt
backgroundtredtactivebackgroundtgreentmenu(t
MenubuttontmBartpacktLEFTtMenuRtadd_commandtentryconfigtDISABLEDRRRtaddtquit(tCommand_button((sC/usr/lib64/python2.7/Demo/tkinter/matt/menu-all-types-of-entries.pytmakeCommandMenu7s,	

cCs�ttdddd�}|jdtdd�t|�|_t|j�|j_t|jj�|jj_|jjjjdd	�|jjjjdd
�|jjjjdd�|jjjdd�|jjjdd
�|jjjdd�|jjjdd�|jjjdd�|jjjdd�|jjj	ddd|jjj�|jj	ddd|jj�|j|d<|S(NRsCascading MenusRiRR	R
Rtavacadosbelgian endivet	beefaronit	ChocolatetVanillatTuttiFruititWopBopaLoopBapABopBamBooms
Rocky Roadt	BubbleGums
Weird FlavorsRsmore choices(
RRRRRRtchoicest	weirdonesRtadd_cascade(tCascade_button((sC/usr/lib64/python2.7/Demo/tkinter/matt/menu-all-types-of-entries.pytmakeCascadeMenues*

cCs�ttdddd�}|jdtdd�t|�|_|jjdd	�|jjdd
�|jjdd�|jjddd
t�|jj|jj	d��|j|d<|S(NRsCheckbutton MenusRiRR	R
Rt	PepperonitSausagesExtra CheesetAnchovyRR(
RRRRRRtadd_checkbuttonRtinvoketindex(tCheckbutton_button((sC/usr/lib64/python2.7/Demo/tkinter/matt/menu-all-types-of-entries.pytmakeCheckbuttonMenu�s	
cCsttdddd�}|jdtdd�t|�|_|jjdd	�|jjdd
�|jjdd�|jjdd�|jjdd
�|jjdd�|jjdd�|jjdd�|jjdd�|jjdd�|j|d<|S(NRsRadiobutton MenusRiRR	R
Rt
RepublicantDemocrattLibertariantCommietFacistsLabor PartytTorietIndependentt	Anarchists
No OpinionR(RRRRRRtadd_radiobutton(tRadiobutton_button((sC/usr/lib64/python2.7/Demo/tkinter/matt/menu-all-types-of-entries.pytmakeRadiobuttonMenu�s 	
cCs<ttdddd�}|jdtdd�t|d<|S(	NRs	Dead MenuRiRR	R
R
(RRRRR (tDummy_button((sC/usr/lib64/python2.7/Demo/tkinter/matt/menu-all-types-of-entries.pytmakeDisabledMenu�s
trelieftborderwidthitfills	menu demoN(tTkinterRRRRRR$R0R8RCREtTktroottFrametRAISEDRRtXR#R/R7RBtNoMenut
tk_menuBarttitleticonnametmainloop(((sC/usr/lib64/python2.7/Demo/tkinter/matt/menu-all-types-of-entries.pyt<module>s,
$					.	&	,								

PK�
Q\a>oQ��"matt/animation-w-velocity-ctrl.pyonu�[����
��^c@s7ddlTdefd��YZe�Zej�dS(i����(t*tTestcBs/eZd�Zd�Zd�Zdd�ZRS(cCs	dGHdS(Nthi((tself((sC/usr/lib64/python2.7/Demo/tkinter/matt/animation-w-velocity-ctrl.pytprintit
sc	Cs�t|ddddd|j�|_|jjdtdt�t|dd	d
d	�|_t|dt	dd
dd�|_
|j
jdtdt�|jjdddddddd�|jjdt
�dS(NttexttQUITt
foregroundtredtcommandtsidetfilltwidtht5itheighttorienttfrom_i����ttoidii
ttagstthingtblue(tButtontquitRtpacktBOTTOMtBOTHtCanvastdrawtScalet
HORIZONTALtspeedtXtcreate_rectangletLEFT(R((sC/usr/lib64/python2.7/Demo/tkinter/matt/animation-w-velocity-ctrl.pyt
createWidgets
s!%cGsY|jj�}t|�d}d|f}|jjd||�|jd|j�dS(Ng@�@s%riRi
(RtgettfloatRtmovetaftert	moveThing(Rtargstvelocitytstr((sC/usr/lib64/python2.7/Demo/tkinter/matt/animation-w-velocity-ctrl.pyR's

cCs>tj||�tj|�|j�|jd|j�dS(Ni
(tFramet__init__tPacktconfigR"R&R'(Rtmaster((sC/usr/lib64/python2.7/Demo/tkinter/matt/animation-w-velocity-ctrl.pyR,#s

N(t__name__t
__module__RR"R'tNoneR,(((sC/usr/lib64/python2.7/Demo/tkinter/matt/animation-w-velocity-ctrl.pyR	s			N(tTkinterR+Rttesttmainloop(((sC/usr/lib64/python2.7/Demo/tkinter/matt/animation-w-velocity-ctrl.pyt<module>s
!	PK�
Q\�nЈ	�	matt/dialog-box.pynu�[���from Tkinter import *
from Dialog import Dialog

# this shows how to create a new window with a button in it
# that can create new windows

class Test(Frame):
    def printit(self):
        print "hi"

    def makeWindow(self):
        """Create a top-level dialog with some buttons.

        This uses the Dialog class, which is a wrapper around the Tcl/Tk
        tk_dialog script.  The function returns 0 if the user clicks 'yes'
        or 1 if the user clicks 'no'.
        """
        # the parameters to this call are as follows:
        d = Dialog(
            self,                       ## name of a toplevel window
            title="fred the dialog box",## title on the window
            text="click on a choice",   ## message to appear in window
            bitmap="info",              ## bitmap (if any) to appear;
                                        ## if none, use ""
            #     legal values here are:
            #      string      what it looks like
            #      ----------------------------------------------
            #      error       a circle with a slash through it
            #      grey25      grey square
            #      grey50      darker grey square
            #      hourglass   use for "wait.."
            #      info        a large, lower case "i"
            #      questhead   a human head with a "?" in it
            #      question    a large "?"
            #      warning     a large "!"
            #        @fname    X bitmap where fname is the path to the file
            #
            default=0,    # the index of the default button choice.
                          # hitting return selects this
            strings=("yes", "no"))
                          # values of the 'strings' key are the labels for the
                          # buttons that appear left to right in the dialog box
        return d.num


    def createWidgets(self):
        self.QUIT = Button(self, text='QUIT', foreground='red',
                           command=self.quit)
        self.QUIT.pack(side=LEFT, fill=BOTH)

        # a hello button
        self.hi_there = Button(self, text='Make a New Window',
                               command=self.makeWindow)
        self.hi_there.pack(side=LEFT)


    def __init__(self, master=None):
        Frame.__init__(self, master)
        Pack.config(self)
        self.windownum = 0
        self.createWidgets()

test = Test()
test.mainloop()
PK�
Q\~����matt/00-HELLO-WORLD.pynu�[���from Tkinter import *

# note that there is no explicit call to start Tk.
# Tkinter is smart enough to start the system if it's not already going.

class Test(Frame):
    def printit(self):
        print "hi"

    def createWidgets(self):
        self.QUIT = Button(self, text='QUIT', foreground='red',
                           command=self.quit)

        self.QUIT.pack(side=LEFT, fill=BOTH)

        # a hello button
        self.hi_there = Button(self, text='Hello',
                               command=self.printit)
        self.hi_there.pack(side=LEFT)

    def __init__(self, master=None):
        Frame.__init__(self, master)
        Pack.config(self)
        self.createWidgets()

test = Test()
test.mainloop()
PK�
Q\b�r;	;	matt/canvas-with-scrollbars.pycnu�[����
��^c@s7ddlTdefd��YZe�Zej�dS(i����(t*tTestcBs/eZd�Zd�Zd�Zdd�ZRS(cCs	dGHdS(Nthi((tself((s@/usr/lib64/python2.7/Demo/tkinter/matt/canvas-with-scrollbars.pytprintit	sc
Cs�t|dd�|_|jj�t|ddddddd|j�|_|jjd	td
t�t|dd�}|jd	t�t	|dd
dd
dddd�|_
t|dt�|j
_
t|dt�|j
_|j
j
j|j
d<|j
jj|j
d<|j
j|j
j
d<|j
j|j
jd<|j
jddddd
d�|j
jddddd
d�|j
j
jd	td
t�|j
jjd	td
t�|j
jd	t�dS(NttextsCan Find The BLUE Square??????tQUITt
backgroundtredtheightitcommandtsidetfills0.25itwidtht5itwhitetscrollregionit20itorienttxscrollcommandtyscrollcommands3.5itblackt10is13.5itblue(iiRR(tLabeltquestiontpacktButtontquitRtBOTTOMtBOTHtFrametCanvastdrawt	Scrollbart
HORIZONTALtscrollXtVERTICALtscrollYtsettxviewtyviewtcreate_rectangletXtRIGHTtYtLEFT(Rtspacer((s@/usr/lib64/python2.7/Demo/tkinter/matt/canvas-with-scrollbars.pyt
createWidgetss*
cGsdG|GH|jjj�GHdS(Nt	scrolling(R!R$tget(Rtargs((s@/usr/lib64/python2.7/Demo/tkinter/matt/canvas-with-scrollbars.pyt
scrollCanvasX0s	cCs+tj||�tj|�|j�dS(N(Rt__init__tPacktconfigR0(Rtmaster((s@/usr/lib64/python2.7/Demo/tkinter/matt/canvas-with-scrollbars.pyR55s
N(t__name__t
__module__RR0R4tNoneR5(((s@/usr/lib64/python2.7/Demo/tkinter/matt/canvas-with-scrollbars.pyRs		$	N(tTkinterRRttesttmainloop(((s@/usr/lib64/python2.7/Demo/tkinter/matt/canvas-with-scrollbars.pyt<module>s
2	PK�
Q\����matt/rubber-line-demo-1.pycnu�[����
��^c@s7ddlTdefd��YZe�Zej�dS(i����(t*tTestcBs8eZd�Zd�Zd�Zd�Zdd�ZRS(cCs	dGHdS(Nthi((tself((s</usr/lib64/python2.7/Demo/tkinter/matt/rubber-line-demo-1.pytprintitscCs{t|ddddddddd	|j�|_|jjd
tdt�t|dd
dd
�|_|jjd
t�dS(NttexttQUITt
backgroundtredt
foregroundtwhitetheightitcommandtsidetfilltwidtht5i(	tButtontquitRtpacktBOTTOMtBOTHtCanvastcanvasObjecttLEFT(R((s</usr/lib64/python2.7/Demo/tkinter/matt/rubber-line-demo-1.pyt
createWidgetsscCs4|jj|j�|_|jj|j�|_dS(N(Rtcanvasxtxtstartxtcanvasytytstarty(Rtevent((s</usr/lib64/python2.7/Demo/tkinter/matt/rubber-line-demo-1.pyt	mouseDownscCs�|jj|j�}|jj|j�}|j|jkr�|j|jkr�|jj|j�|jj	|j|j||�|_|j
�ndS(N(RRRRRRRtdeletetrubberbandLinetcreate_linetupdate_idletasks(RR RR((s</usr/lib64/python2.7/Demo/tkinter/matt/rubber-line-demo-1.pytmouseMotions$	cCsftj||�tj|�|j�d|_tj|j	d|j
�tj|j	d|j�dS(Ns
<Button-1>s<Button1-Motion>(tFramet__init__tPacktconfigRtNoneR#tWidgettbindRR!R&(Rtmaster((s</usr/lib64/python2.7/Demo/tkinter/matt/rubber-line-demo-1.pyR('s

	N(t__name__t
__module__RRR!R&R+R((((s</usr/lib64/python2.7/Demo/tkinter/matt/rubber-line-demo-1.pyRs
				N(tTkinterR'Rttesttmainloop(((s</usr/lib64/python2.7/Demo/tkinter/matt/rubber-line-demo-1.pyt<module>s
.	PK�
Q\~ǁ���"matt/not-what-you-might-think-2.pynu�[���from Tkinter import *


class Test(Frame):
    def createWidgets(self):

        self.Gpanel = Frame(self, width='1i', height='1i',
                            background='green')

        # this line turns off the recalculation of geometry by masters.
        self.Gpanel.propagate(0)

        self.Gpanel.pack(side=LEFT)

        # a QUIT button
        self.Gpanel.QUIT = Button(self.Gpanel, text='QUIT', foreground='red',
                                  command=self.quit)
        self.Gpanel.QUIT.pack(side=LEFT)

    def __init__(self, master=None):
        Frame.__init__(self, master)
        Pack.config(self)
        self.createWidgets()

test = Test()

test.master.title('packer demo')
test.master.iconname('packer')

test.mainloop()
PK�
Q\a>oQ��"matt/animation-w-velocity-ctrl.pycnu�[����
��^c@s7ddlTdefd��YZe�Zej�dS(i����(t*tTestcBs/eZd�Zd�Zd�Zdd�ZRS(cCs	dGHdS(Nthi((tself((sC/usr/lib64/python2.7/Demo/tkinter/matt/animation-w-velocity-ctrl.pytprintit
sc	Cs�t|ddddd|j�|_|jjdtdt�t|dd	d
d	�|_t|dt	dd
dd�|_
|j
jdtdt�|jjdddddddd�|jjdt
�dS(NttexttQUITt
foregroundtredtcommandtsidetfilltwidtht5itheighttorienttfrom_i����ttoidii
ttagstthingtblue(tButtontquitRtpacktBOTTOMtBOTHtCanvastdrawtScalet
HORIZONTALtspeedtXtcreate_rectangletLEFT(R((sC/usr/lib64/python2.7/Demo/tkinter/matt/animation-w-velocity-ctrl.pyt
createWidgets
s!%cGsY|jj�}t|�d}d|f}|jjd||�|jd|j�dS(Ng@�@s%riRi
(RtgettfloatRtmovetaftert	moveThing(Rtargstvelocitytstr((sC/usr/lib64/python2.7/Demo/tkinter/matt/animation-w-velocity-ctrl.pyR's

cCs>tj||�tj|�|j�|jd|j�dS(Ni
(tFramet__init__tPacktconfigR"R&R'(Rtmaster((sC/usr/lib64/python2.7/Demo/tkinter/matt/animation-w-velocity-ctrl.pyR,#s

N(t__name__t
__module__RR"R'tNoneR,(((sC/usr/lib64/python2.7/Demo/tkinter/matt/animation-w-velocity-ctrl.pyR	s			N(tTkinterR+Rttesttmainloop(((sC/usr/lib64/python2.7/Demo/tkinter/matt/animation-w-velocity-ctrl.pyt<module>s
!	PK�
Q\���ll#matt/packer-and-placer-together.pycnu�[����
��^c@seddlTd�Zd�Zd�Ze�Zee�Zejd�ejdd�ej	�dS(i����(t*cCs#tjjd|jd|j�dS(Ntxty(tapptbuttontplaceRR(tevent((sD/usr/lib64/python2.7/Demo/tkinter/matt/packer-and-placer-together.pyt	do_motionscCs	dGHdS(Nscalling me!((((sD/usr/lib64/python2.7/Demo/tkinter/matt/packer-and-placer-together.pytdothis
scCs�t|dddddd�}|jdtdd�t|d	d
ddd
t�|_|jjdddddt�|jdt	�|S(Ntwidthi�theightt
backgroundtgreentfilltexpandit
foregroundtredttexttamazingtcommandtrelxg�?trelygtanchors<Control-Shift-Motion>(
tFrametpacktBOTHtButtonRRRtNWtbindR(ttoptf((sD/usr/lib64/python2.7/Demo/tkinter/matt/packer-and-placer-together.pyt
createWidgets
s!t400x400i�N(
tTkinterRRRtTktrootRtgeometrytmaxsizetmainloop(((sD/usr/lib64/python2.7/Demo/tkinter/matt/packer-and-placer-together.pyt<module>s
				
PK�
Q\���d�� matt/canvas-w-widget-draw-el.pycnu�[����
��^c@s7ddlTdefd��YZe�Zej�dS(i����(t*tTestcBs&eZd�Zd�Zdd�ZRS(cCs	dGHdS(Nthi((tself((sA/usr/lib64/python2.7/Demo/tkinter/matt/canvas-w-widget-draw-el.pytprinthiscCs�t|ddddd|j�|_|jjdtdt�t|dd	d
d	�|_t|ddd|j�|_	|jj
ddd
|j	�|jjdt�dS(NttexttQUITt
foregroundtredtcommandtsidetfilltwidtht5itheightsthis is a buttoni,twindow(tButtontquitRtpacktBOTTOMtBOTHtCanvastdrawRtbuttont
create_windowtLEFT(R((sA/usr/lib64/python2.7/Demo/tkinter/matt/canvas-w-widget-draw-el.pyt
createWidgets	scCs+tj||�tj|�|j�dS(N(tFramet__init__tPacktconfigR(Rtmaster((sA/usr/lib64/python2.7/Demo/tkinter/matt/canvas-w-widget-draw-el.pyRs
N(t__name__t
__module__RRtNoneR(((sA/usr/lib64/python2.7/Demo/tkinter/matt/canvas-w-widget-draw-el.pyRs		N(tTkinterRRttesttmainloop(((sA/usr/lib64/python2.7/Demo/tkinter/matt/canvas-w-widget-draw-el.pyt<module>s
	PK�
Q\;mDD matt/canvas-reading-tag-info.pycnu�[����
��^c@s7ddlTdefd��YZe�Zej�dS(i����(t*tTestcBs&eZd�Zd�Zdd�ZRS(cCs	dGHdS(Nthi((tself((sA/usr/lib64/python2.7/Demo/tkinter/matt/canvas-reading-tag-info.pytprintitscCs!t|ddddd|j�|_|jjdtdt�t|dd	d
d	�|_|jjddddddddddd
d�}|jj	|d�}dG|dGdGH|jj	|d�}dG|dGdGHdG|dGdGH|jj	|d
�}dG|dGH|jjdt
�dS(NttexttQUITt
foregroundtredtcommandtsidetfilltwidtht5itheighti
inttagstweeetfootgrootstipples#pgon's current stipple value is -->is<--s pgon's current fill value is -->s   when he is usually colored -->ispgon's tags are(RRR(tButtontquitRtpacktBOTTOMtBOTHtCanvastdrawingtcreate_polygont
itemconfigtLEFT(Rtpgontoption_value((sA/usr/lib64/python2.7/Demo/tkinter/matt/canvas-reading-tag-info.pyt
createWidgetss	
cCs+tj||�tj|�|j�dS(N(tFramet__init__tPacktconfigR (Rtmaster((sA/usr/lib64/python2.7/Demo/tkinter/matt/canvas-reading-tag-info.pyR"*s
N(t__name__t
__module__RR tNoneR"(((sA/usr/lib64/python2.7/Demo/tkinter/matt/canvas-reading-tag-info.pyRs		"N(tTkinterR!Rttesttmainloop(((sA/usr/lib64/python2.7/Demo/tkinter/matt/canvas-reading-tag-info.pyt<module>s
+	PK�
Q\�Fֳ�matt/menu-simple.pynu�[���from Tkinter import *

# some vocabulary to keep from getting confused. This terminology
# is something I cooked up for this file, but follows the man pages
# pretty closely
#
#
#
#       This is a MENUBUTTON
#       V
# +-------------+
# |             |
#
# +------------++------------++------------+
# |            ||            ||            |
# |  File      ||  Edit      || Options    |   <-------- the MENUBAR
# |            ||            ||            |
# +------------++------------++------------+
# | New...         |
# | Open...        |
# | Print          |
# |                |  <------ This is a MENU. The lines of text in the menu are
# |                |                          MENU ENTRIES
# |                +---------------+
# | Open Files >   | file1         |
# |                | file2         |
# |                | another file  | <------ this cascading part is also a MENU
# +----------------|               |
#                  |               |
#                  |               |
#                  |               |
#                  +---------------+



def new_file():
    print "opening new file"


def open_file():
    print "opening OLD file"


def makeFileMenu():
    # make menu button : "File"
    File_button = Menubutton(mBar, text='File', underline=0)
    File_button.pack(side=LEFT, padx="1m")
    File_button.menu = Menu(File_button)

    # add an item. The first param is a menu entry type,
    # must be one of: "cascade", "checkbutton", "command", "radiobutton", "separator"
    # see menu-demo-2.py for examples of use
    File_button.menu.add_command(label='New...', underline=0,
                                 command=new_file)


    File_button.menu.add_command(label='Open...', underline=0,
                                 command=open_file)

    File_button.menu.add_command(label='Quit', underline=0,
                                 command='exit')

    # set up a pointer from the file menubutton back to the file menu
    File_button['menu'] = File_button.menu

    return File_button



def makeEditMenu():
    Edit_button = Menubutton(mBar, text='Edit', underline=0)
    Edit_button.pack(side=LEFT, padx="1m")
    Edit_button.menu = Menu(Edit_button)

    # just to be cute, let's disable the undo option:
    Edit_button.menu.add('command', label="Undo")
    # Since the tear-off bar is the 0th entry,
    # undo is the 1st entry...
    Edit_button.menu.entryconfig(1, state=DISABLED)

    # and these are just for show. No "command" callbacks attached.
    Edit_button.menu.add_command(label="Cut")
    Edit_button.menu.add_command(label="Copy")
    Edit_button.menu.add_command(label="Paste")

    # set up a pointer from the file menubutton back to the file menu
    Edit_button['menu'] = Edit_button.menu

    return Edit_button


#################################################

#### Main starts here ...
root = Tk()


# make a menu bar
mBar = Frame(root, relief=RAISED, borderwidth=2)
mBar.pack(fill=X)

File_button = makeFileMenu()
Edit_button = makeEditMenu()

# finally, install the buttons in the menu bar.
# This allows for scanning from one menubutton to the next.
mBar.tk_menuBar(File_button, Edit_button)

root.title('menu demo')
root.iconname('packer')

root.mainloop()
PK�
Q\��ZZ��matt/window-creation-more.pycnu�[����
��^c@s7ddlTdefd��YZe�Zej�dS(i����(t*tTestcBs/eZd�Zd�Zd�Zdd�ZRS(cCs	dGHdS(Nthi((tself((s>/usr/lib64/python2.7/Demo/tkinter/matt/window-creation-more.pytprintitscCsOt�}t|dd|jd|j�|_|jj�|jd|_dS(NttextsThis is window number %d.tcommandi(tTopleveltButtont	windownumt
makeWindowtlabeltpack(Rtfred((s>/usr/lib64/python2.7/Demo/tkinter/matt/window-creation-more.pyR

s		

cCsrt|ddddd|j�|_|jjdtdt�t|ddd|j�|_|jjdt�dS(	NRtQUITt
foregroundtredRtsidetfillsMake a New Window(RtquitRRtLEFTtBOTHR
thi_there(R((s>/usr/lib64/python2.7/Demo/tkinter/matt/window-creation-more.pyt
createWidgetsscCs4tj||�tj|�d|_|j�dS(Ni(tFramet__init__tPacktconfigR	R(Rtmaster((s>/usr/lib64/python2.7/Demo/tkinter/matt/window-creation-more.pyRs
	N(t__name__t
__module__RR
RtNoneR(((s>/usr/lib64/python2.7/Demo/tkinter/matt/window-creation-more.pyRs			
N(tTkinterRRttesttmainloop(((s>/usr/lib64/python2.7/Demo/tkinter/matt/window-creation-more.pyt<module>s
	PK�
Q\��t44matt/entry-simple.pyonu�[����
��^c@sSddlTddlZdefd��YZe�Zejjd�ej�dS(i����(t*NtAppcBseZdd�Zd�ZRS(cCsMtj||�|j�t�|_|jj�|jjd|j�dS(Ns<Key-Return>(tFramet__init__tpacktEntrytentrythingytbindtprint_contents(tselftmaster((s6/usr/lib64/python2.7/Demo/tkinter/matt/entry-simple.pyRs


cCsdG|jj�GHdS(Ns"hi. contents of entry is now ---->(Rtget(R	tevent((s6/usr/lib64/python2.7/Demo/tkinter/matt/entry-simple.pyRsN(t__name__t
__module__tNoneRR(((s6/usr/lib64/python2.7/Demo/tkinter/matt/entry-simple.pyRstFoo(tTkintertstringRRtrootR
ttitletmainloop(((s6/usr/lib64/python2.7/Demo/tkinter/matt/entry-simple.pyt<module>s

	PK�
Q\�uk/��matt/animation-simple.pynu�[���from Tkinter import *

# This program shows how to use the "after" function to make animation.

class Test(Frame):
    def printit(self):
        print "hi"

    def createWidgets(self):
        self.QUIT = Button(self, text='QUIT', foreground='red',
                           command=self.quit)
        self.QUIT.pack(side=LEFT, fill=BOTH)

        self.draw = Canvas(self, width="5i", height="5i")

        # all of these work..
        self.draw.create_rectangle(0, 0, 10, 10, tags="thing", fill="blue")
        self.draw.pack(side=LEFT)

    def moveThing(self, *args):
        # move 1/10 of an inch every 1/10 sec (1" per second, smoothly)
        self.draw.move("thing", "0.01i", "0.01i")
        self.after(10, self.moveThing)


    def __init__(self, master=None):
        Frame.__init__(self, master)
        Pack.config(self)
        self.createWidgets()
        self.after(10, self.moveThing)


test = Test()

test.mainloop()
PK�
Q\�w�� matt/bind-w-mult-calls-p-type.pynu�[���from Tkinter import *
import string

# This program  shows how to use a simple type-in box

class App(Frame):
    def __init__(self, master=None):
        Frame.__init__(self, master)
        self.pack()

        self.entrythingy = Entry()
        self.entrythingy.pack()

        # and here we get a callback when the user hits return. we could
        # make the key that triggers the callback anything we wanted to.
        # other typical options might be <Key-Tab> or <Key> (for anything)
        self.entrythingy.bind('<Key-Return>', self.print_contents)

        # Note that here is where we bind a completely different callback to
        # the same event. We pass "+" here to indicate that we wish to ADD
        # this callback to the list associated with this event type.
        # Not specifying "+" would simply override whatever callback was
        # defined on this event.
        self.entrythingy.bind('<Key-Return>', self.print_something_else, "+")

    def print_contents(self, event):
        print "hi. contents of entry is now ---->", self.entrythingy.get()


    def print_something_else(self, event):
        print "hi. Now doing something completely different"


root = App()
root.master.title("Foo")
root.mainloop()



# secret tip for experts: if you pass *any* non-false value as
# the third parameter to bind(), Tkinter.py will accumulate
# callbacks instead of overwriting. I use "+" here because that's
# the Tk notation for getting this sort of behavior. The perfect GUI
# interface would use a less obscure notation.
PK�
Q\�� �yy!matt/bind-w-mult-calls-p-type.pycnu�[����
��^c@sSddlTddlZdefd��YZe�Zejjd�ej�dS(i����(t*NtAppcBs&eZdd�Zd�Zd�ZRS(cCsftj||�|j�t�|_|jj�|jjd|j�|jjd|jd�dS(Ns<Key-Return>t+(tFramet__init__tpacktEntrytentrythingytbindtprint_contentstprint_something_else(tselftmaster((sB/usr/lib64/python2.7/Demo/tkinter/matt/bind-w-mult-calls-p-type.pyRs

cCsdG|jj�GHdS(Ns"hi. contents of entry is now ---->(Rtget(Rtevent((sB/usr/lib64/python2.7/Demo/tkinter/matt/bind-w-mult-calls-p-type.pyR	scCs	dGHdS(Ns,hi. Now doing something completely different((RR((sB/usr/lib64/python2.7/Demo/tkinter/matt/bind-w-mult-calls-p-type.pyR
sN(t__name__t
__module__tNoneRR	R
(((sB/usr/lib64/python2.7/Demo/tkinter/matt/bind-w-mult-calls-p-type.pyRs	tFoo(tTkintertstringRRtrootRttitletmainloop(((sB/usr/lib64/python2.7/Demo/tkinter/matt/bind-w-mult-calls-p-type.pyt<module>s

	PK�
Q\����matt/rubber-line-demo-1.pyonu�[����
��^c@s7ddlTdefd��YZe�Zej�dS(i����(t*tTestcBs8eZd�Zd�Zd�Zd�Zdd�ZRS(cCs	dGHdS(Nthi((tself((s</usr/lib64/python2.7/Demo/tkinter/matt/rubber-line-demo-1.pytprintitscCs{t|ddddddddd	|j�|_|jjd
tdt�t|dd
dd
�|_|jjd
t�dS(NttexttQUITt
backgroundtredt
foregroundtwhitetheightitcommandtsidetfilltwidtht5i(	tButtontquitRtpacktBOTTOMtBOTHtCanvastcanvasObjecttLEFT(R((s</usr/lib64/python2.7/Demo/tkinter/matt/rubber-line-demo-1.pyt
createWidgetsscCs4|jj|j�|_|jj|j�|_dS(N(Rtcanvasxtxtstartxtcanvasytytstarty(Rtevent((s</usr/lib64/python2.7/Demo/tkinter/matt/rubber-line-demo-1.pyt	mouseDownscCs�|jj|j�}|jj|j�}|j|jkr�|j|jkr�|jj|j�|jj	|j|j||�|_|j
�ndS(N(RRRRRRRtdeletetrubberbandLinetcreate_linetupdate_idletasks(RR RR((s</usr/lib64/python2.7/Demo/tkinter/matt/rubber-line-demo-1.pytmouseMotions$	cCsftj||�tj|�|j�d|_tj|j	d|j
�tj|j	d|j�dS(Ns
<Button-1>s<Button1-Motion>(tFramet__init__tPacktconfigRtNoneR#tWidgettbindRR!R&(Rtmaster((s</usr/lib64/python2.7/Demo/tkinter/matt/rubber-line-demo-1.pyR('s

	N(t__name__t
__module__RRR!R&R+R((((s</usr/lib64/python2.7/Demo/tkinter/matt/rubber-line-demo-1.pyRs
				N(tTkinterR'Rttesttmainloop(((s</usr/lib64/python2.7/Demo/tkinter/matt/rubber-line-demo-1.pyt<module>s
.	PK�
Q\�x�#�#!matt/menu-all-types-of-entries.pynu�[���from Tkinter import *

# some vocabulary to keep from getting confused. This terminology
# is something I cooked up for this file, but follows the man pages
# pretty closely
#
#
#
#       This is a MENUBUTTON
#       V
# +-------------+
# |             |
#
# +------------++------------++------------+
# |            ||            ||            |
# |  File      ||  Edit      || Options    |   <-------- the MENUBAR
# |            ||            ||            |
# +------------++------------++------------+
# | New...         |
# | Open...        |
# | Print          |
# |                |  <-------- This is a MENU. The lines of text in the menu are
# |                |                            MENU ENTRIES
# |                +---------------+
# | Open Files >   | file1         |
# |                | file2         |
# |                | another file  | <------ this cascading part is also a MENU
# +----------------|               |
#                  |               |
#                  |               |
#                  |               |
#                  +---------------+



# some miscellaneous callbacks
def new_file():
    print "opening new file"

def open_file():
    print "opening OLD file"

def print_something():
    print "picked a menu item"



anchovies = 0

def print_anchovies():
    global anchovies
    anchovies = not anchovies
    print "anchovies?", anchovies

def makeCommandMenu():
    # make menu button
    Command_button = Menubutton(mBar, text='Simple Button Commands',
                                underline=0)
    Command_button.pack(side=LEFT, padx="2m")

    # make the pulldown part of the File menu. The parameter passed is the master.
    # we attach it to the button as a python attribute called "menu" by convention.
    # hopefully this isn't too confusing...
    Command_button.menu = Menu(Command_button)

    # just to be cute, let's disable the undo option:
    Command_button.menu.add_command(label="Undo")
    # undo is the 0th entry...
    Command_button.menu.entryconfig(0, state=DISABLED)

    Command_button.menu.add_command(label='New...', underline=0,
                                    command=new_file)
    Command_button.menu.add_command(label='Open...', underline=0,
                                    command=open_file)
    Command_button.menu.add_command(label='Different Font', underline=0,
                                    font='-*-helvetica-*-r-*-*-*-180-*-*-*-*-*-*',
                                    command=print_something)

    # we can make bitmaps be menu entries too. File format is X11 bitmap.
    # if you use XV, save it under X11 bitmap format. duh-uh.,..
    Command_button.menu.add_command(
        bitmap="info")
        #bitmap='@/home/mjc4y/dilbert/project.status.is.doomed.last.panel.bm')

    # this is just a line
    Command_button.menu.add('separator')

    # change the color
    Command_button.menu.add_command(label='Quit', underline=0,
                                    background='red',
                                    activebackground='green',
                                    command=Command_button.quit)

    # set up a pointer from the file menubutton back to the file menu
    Command_button['menu'] = Command_button.menu

    return Command_button



def makeCascadeMenu():
    # make menu button
    Cascade_button = Menubutton(mBar, text='Cascading Menus', underline=0)
    Cascade_button.pack(side=LEFT, padx="2m")

    # the primary pulldown
    Cascade_button.menu = Menu(Cascade_button)

    # this is the menu that cascades from the primary pulldown....
    Cascade_button.menu.choices = Menu(Cascade_button.menu)

    # ...and this is a menu that cascades from that.
    Cascade_button.menu.choices.weirdones = Menu(Cascade_button.menu.choices)

    # then you define the menus from the deepest level on up.
    Cascade_button.menu.choices.weirdones.add_command(label='avacado')
    Cascade_button.menu.choices.weirdones.add_command(label='belgian endive')
    Cascade_button.menu.choices.weirdones.add_command(label='beefaroni')

    # definition of the menu one level up...
    Cascade_button.menu.choices.add_command(label='Chocolate')
    Cascade_button.menu.choices.add_command(label='Vanilla')
    Cascade_button.menu.choices.add_command(label='TuttiFruiti')
    Cascade_button.menu.choices.add_command(label='WopBopaLoopBapABopBamBoom')
    Cascade_button.menu.choices.add_command(label='Rocky Road')
    Cascade_button.menu.choices.add_command(label='BubbleGum')
    Cascade_button.menu.choices.add_cascade(
        label='Weird Flavors',
        menu=Cascade_button.menu.choices.weirdones)

    # and finally, the definition for the top level
    Cascade_button.menu.add_cascade(label='more choices',
                                    menu=Cascade_button.menu.choices)

    Cascade_button['menu'] = Cascade_button.menu

    return Cascade_button

def makeCheckbuttonMenu():
    global fred
    # make menu button
    Checkbutton_button = Menubutton(mBar, text='Checkbutton Menus',
                                    underline=0)
    Checkbutton_button.pack(side=LEFT, padx='2m')

    # the primary pulldown
    Checkbutton_button.menu = Menu(Checkbutton_button)

    # and all the check buttons. Note that the "variable" "onvalue" and "offvalue" options
    # are not supported correctly at present. You have to do all your application
    # work through the calback.
    Checkbutton_button.menu.add_checkbutton(label='Pepperoni')
    Checkbutton_button.menu.add_checkbutton(label='Sausage')
    Checkbutton_button.menu.add_checkbutton(label='Extra Cheese')

    # so here's a callback
    Checkbutton_button.menu.add_checkbutton(label='Anchovy',
                                            command=print_anchovies)

    # and start with anchovies selected to be on. Do this by
    # calling invoke on this menu option. To refer to the "anchovy" menu
    # entry we need to know it's index. To do this, we use the index method
    # which takes arguments of several forms:
    #
    # argument        what it does
    # -----------------------------------
    # a number        -- this is useless.
    # "last"          -- last option in the menu
    # "none"          -- used with the activate command. see the man page on menus
    # "active"        -- the currently active menu option. A menu option is made active
    #                         with the 'activate' method
    # "@number"       -- where 'number' is an integer and is treated like a y coordinate in pixels
    # string pattern  -- this is the option used below, and attempts to match "labels" using the
    #                    rules of Tcl_StringMatch
    Checkbutton_button.menu.invoke(Checkbutton_button.menu.index('Anchovy'))

    # set up a pointer from the file menubutton back to the file menu
    Checkbutton_button['menu'] = Checkbutton_button.menu

    return Checkbutton_button


def makeRadiobuttonMenu():
    # make menu button
    Radiobutton_button = Menubutton(mBar, text='Radiobutton Menus',
                                    underline=0)
    Radiobutton_button.pack(side=LEFT, padx='2m')

    # the primary pulldown
    Radiobutton_button.menu = Menu(Radiobutton_button)

    # and all the Radio buttons. Note that the "variable" "onvalue" and "offvalue" options
    # are not supported correctly at present. You have to do all your application
    # work through the calback.
    Radiobutton_button.menu.add_radiobutton(label='Republican')
    Radiobutton_button.menu.add_radiobutton(label='Democrat')
    Radiobutton_button.menu.add_radiobutton(label='Libertarian')
    Radiobutton_button.menu.add_radiobutton(label='Commie')
    Radiobutton_button.menu.add_radiobutton(label='Facist')
    Radiobutton_button.menu.add_radiobutton(label='Labor Party')
    Radiobutton_button.menu.add_radiobutton(label='Torie')
    Radiobutton_button.menu.add_radiobutton(label='Independent')
    Radiobutton_button.menu.add_radiobutton(label='Anarchist')
    Radiobutton_button.menu.add_radiobutton(label='No Opinion')

    # set up a pointer from the file menubutton back to the file menu
    Radiobutton_button['menu'] = Radiobutton_button.menu

    return Radiobutton_button


def makeDisabledMenu():
    Dummy_button = Menubutton(mBar, text='Dead Menu', underline=0)
    Dummy_button.pack(side=LEFT, padx='2m')

    # this is the standard way of turning off a whole menu
    Dummy_button["state"] = DISABLED
    return Dummy_button


#################################################
#### Main starts here ...
root = Tk()


# make a menu bar
mBar = Frame(root, relief=RAISED, borderwidth=2)
mBar.pack(fill=X)

Command_button     = makeCommandMenu()
Cascade_button     = makeCascadeMenu()
Checkbutton_button = makeCheckbuttonMenu()
Radiobutton_button = makeRadiobuttonMenu()
NoMenu             = makeDisabledMenu()

# finally, install the buttons in the menu bar.
# This allows for scanning from one menubutton to the next.
mBar.tk_menuBar(Command_button, Cascade_button, Checkbutton_button, Radiobutton_button, NoMenu)


root.title('menu demo')
root.iconname('menu demo')

root.mainloop()
PK�
Q\�!��matt/READMEnu�[���This directory contains some ad-hoc examples of Tkinter widget
creation. The files named 

		*-simple.py

are the ones to start with if you're looking for a bare-bones usage of
a widget. The other files are meant to show common usage patters that
are a tad more involved. 

If you have a suggestion for an example program, please send mail to 
	
	conway@virginia.edu

and I'll include it.


matt

TODO
-------
The X selection
Dialog Boxes
More canvas examples
Message widgets
Text Editors
Scrollbars
Listboxes



PK�
Q\b�r;	;	matt/canvas-with-scrollbars.pyonu�[����
��^c@s7ddlTdefd��YZe�Zej�dS(i����(t*tTestcBs/eZd�Zd�Zd�Zdd�ZRS(cCs	dGHdS(Nthi((tself((s@/usr/lib64/python2.7/Demo/tkinter/matt/canvas-with-scrollbars.pytprintit	sc
Cs�t|dd�|_|jj�t|ddddddd|j�|_|jjd	td
t�t|dd�}|jd	t�t	|dd
dd
dddd�|_
t|dt�|j
_
t|dt�|j
_|j
j
j|j
d<|j
jj|j
d<|j
j|j
j
d<|j
j|j
jd<|j
jddddd
d�|j
jddddd
d�|j
j
jd	td
t�|j
jjd	td
t�|j
jd	t�dS(NttextsCan Find The BLUE Square??????tQUITt
backgroundtredtheightitcommandtsidetfills0.25itwidtht5itwhitetscrollregionit20itorienttxscrollcommandtyscrollcommands3.5itblackt10is13.5itblue(iiRR(tLabeltquestiontpacktButtontquitRtBOTTOMtBOTHtFrametCanvastdrawt	Scrollbart
HORIZONTALtscrollXtVERTICALtscrollYtsettxviewtyviewtcreate_rectangletXtRIGHTtYtLEFT(Rtspacer((s@/usr/lib64/python2.7/Demo/tkinter/matt/canvas-with-scrollbars.pyt
createWidgetss*
cGsdG|GH|jjj�GHdS(Nt	scrolling(R!R$tget(Rtargs((s@/usr/lib64/python2.7/Demo/tkinter/matt/canvas-with-scrollbars.pyt
scrollCanvasX0s	cCs+tj||�tj|�|j�dS(N(Rt__init__tPacktconfigR0(Rtmaster((s@/usr/lib64/python2.7/Demo/tkinter/matt/canvas-with-scrollbars.pyR55s
N(t__name__t
__module__RR0R4tNoneR5(((s@/usr/lib64/python2.7/Demo/tkinter/matt/canvas-with-scrollbars.pyRs		$	N(tTkinterRRttesttmainloop(((s@/usr/lib64/python2.7/Demo/tkinter/matt/canvas-with-scrollbars.pyt<module>s
2	PK�
Q\��Vkk"matt/menu-all-types-of-entries.pycnu�[����
��^c@sddlTd�Zd�Zd�Zdad�Zd�Zd�Zd	�Zd
�Z	d�Z
e�Ze
eded
d�Zejde�e�Ze�Ze�Ze	�Ze
�Zejeeeee�ejd�ejd�ej�dS(i����(t*cCs	dGHdS(Nsopening new file((((sC/usr/lib64/python2.7/Demo/tkinter/matt/menu-all-types-of-entries.pytnew_file%scCs	dGHdS(Nsopening OLD file((((sC/usr/lib64/python2.7/Demo/tkinter/matt/menu-all-types-of-entries.pyt	open_file(scCs	dGHdS(Nspicked a menu item((((sC/usr/lib64/python2.7/Demo/tkinter/matt/menu-all-types-of-entries.pytprint_something+sicCstadGtGHdS(Ns
anchovies?(t	anchovies(((sC/usr/lib64/python2.7/Demo/tkinter/matt/menu-all-types-of-entries.pytprint_anchovies2scCs+ttdddd�}|jdtdd�t|�|_|jjdd	�|jjdd
t�|jjdddddt	�|jjdd
dddt
�|jjdddddddt�|jjdd�|jjd�|jjddddddddd|j
�|j|d<|S(NttextsSimple Button Commandst	underlineitsidetpadxt2mtlabeltUndotstatesNew...tcommandsOpen...sDifferent Fonttfonts&-*-helvetica-*-r-*-*-*-180-*-*-*-*-*-*tbitmaptinfot	separatortQuitt
backgroundtredtactivebackgroundtgreentmenu(t
MenubuttontmBartpacktLEFTtMenuRtadd_commandtentryconfigtDISABLEDRRRtaddtquit(tCommand_button((sC/usr/lib64/python2.7/Demo/tkinter/matt/menu-all-types-of-entries.pytmakeCommandMenu7s,	

cCs�ttdddd�}|jdtdd�t|�|_t|j�|j_t|jj�|jj_|jjjjdd	�|jjjjdd
�|jjjjdd�|jjjdd�|jjjdd
�|jjjdd�|jjjdd�|jjjdd�|jjjdd�|jjj	ddd|jjj�|jj	ddd|jj�|j|d<|S(NRsCascading MenusRiRR	R
Rtavacadosbelgian endivet	beefaronit	ChocolatetVanillatTuttiFruititWopBopaLoopBapABopBamBooms
Rocky Roadt	BubbleGums
Weird FlavorsRsmore choices(
RRRRRRtchoicest	weirdonesRtadd_cascade(tCascade_button((sC/usr/lib64/python2.7/Demo/tkinter/matt/menu-all-types-of-entries.pytmakeCascadeMenues*

cCs�ttdddd�}|jdtdd�t|�|_|jjdd	�|jjdd
�|jjdd�|jjddd
t�|jj|jj	d��|j|d<|S(NRsCheckbutton MenusRiRR	R
Rt	PepperonitSausagesExtra CheesetAnchovyRR(
RRRRRRtadd_checkbuttonRtinvoketindex(tCheckbutton_button((sC/usr/lib64/python2.7/Demo/tkinter/matt/menu-all-types-of-entries.pytmakeCheckbuttonMenu�s	
cCsttdddd�}|jdtdd�t|�|_|jjdd	�|jjdd
�|jjdd�|jjdd�|jjdd
�|jjdd�|jjdd�|jjdd�|jjdd�|jjdd�|j|d<|S(NRsRadiobutton MenusRiRR	R
Rt
RepublicantDemocrattLibertariantCommietFacistsLabor PartytTorietIndependentt	Anarchists
No OpinionR(RRRRRRtadd_radiobutton(tRadiobutton_button((sC/usr/lib64/python2.7/Demo/tkinter/matt/menu-all-types-of-entries.pytmakeRadiobuttonMenu�s 	
cCs<ttdddd�}|jdtdd�t|d<|S(	NRs	Dead MenuRiRR	R
R
(RRRRR (tDummy_button((sC/usr/lib64/python2.7/Demo/tkinter/matt/menu-all-types-of-entries.pytmakeDisabledMenu�s
trelieftborderwidthitfills	menu demoN(tTkinterRRRRRR$R0R8RCREtTktroottFrametRAISEDRRtXR#R/R7RBtNoMenut
tk_menuBarttitleticonnametmainloop(((sC/usr/lib64/python2.7/Demo/tkinter/matt/menu-all-types-of-entries.pyt<module>s,
$					.	&	,								

PK�
Q\���ll#matt/packer-and-placer-together.pyonu�[����
��^c@seddlTd�Zd�Zd�Ze�Zee�Zejd�ejdd�ej	�dS(i����(t*cCs#tjjd|jd|j�dS(Ntxty(tapptbuttontplaceRR(tevent((sD/usr/lib64/python2.7/Demo/tkinter/matt/packer-and-placer-together.pyt	do_motionscCs	dGHdS(Nscalling me!((((sD/usr/lib64/python2.7/Demo/tkinter/matt/packer-and-placer-together.pytdothis
scCs�t|dddddd�}|jdtdd�t|d	d
ddd
t�|_|jjdddddt�|jdt	�|S(Ntwidthi�theightt
backgroundtgreentfilltexpandit
foregroundtredttexttamazingtcommandtrelxg�?trelygtanchors<Control-Shift-Motion>(
tFrametpacktBOTHtButtonRRRtNWtbindR(ttoptf((sD/usr/lib64/python2.7/Demo/tkinter/matt/packer-and-placer-together.pyt
createWidgets
s!t400x400i�N(
tTkinterRRRtTktrootRtgeometrytmaxsizetmainloop(((sD/usr/lib64/python2.7/Demo/tkinter/matt/packer-and-placer-together.pyt<module>s
				
PK�
Q\`MY��!matt/subclass-existing-widgets.pynu�[���from Tkinter import *

# This is a program that makes a simple two button application


class New_Button(Button):
    def callback(self):
        print self.counter
        self.counter = self.counter + 1

def createWidgets(top):
    f = Frame(top)
    f.pack()
    f.QUIT = Button(f, text='QUIT', foreground='red', command=top.quit)

    f.QUIT.pack(side=LEFT, fill=BOTH)

    # a hello button
    f.hi_there = New_Button(f, text='Hello')
    # we do this on a different line because we need to reference f.hi_there
    f.hi_there.config(command=f.hi_there.callback)
    f.hi_there.pack(side=LEFT)
    f.hi_there.counter = 43


root = Tk()
createWidgets(root)
root.mainloop()
PK�
Q\��gmatt/00-HELLO-WORLD.pyonu�[����
��^c@s7ddlTdefd��YZe�Zej�dS(i����(t*tTestcBs&eZd�Zd�Zdd�ZRS(cCs	dGHdS(Nthi((tself((s8/usr/lib64/python2.7/Demo/tkinter/matt/00-HELLO-WORLD.pytprintitscCsrt|ddddd|j�|_|jjdtdt�t|ddd|j�|_|jjdt�dS(	NttexttQUITt
foregroundtredtcommandtsidetfilltHello(tButtontquitRtpacktLEFTtBOTHRthi_there(R((s8/usr/lib64/python2.7/Demo/tkinter/matt/00-HELLO-WORLD.pyt
createWidgets
scCs+tj||�tj|�|j�dS(N(tFramet__init__tPacktconfigR(Rtmaster((s8/usr/lib64/python2.7/Demo/tkinter/matt/00-HELLO-WORLD.pyRs
N(t__name__t
__module__RRtNoneR(((s8/usr/lib64/python2.7/Demo/tkinter/matt/00-HELLO-WORLD.pyRs		N(tTkinterRRttesttmainloop(((s8/usr/lib64/python2.7/Demo/tkinter/matt/00-HELLO-WORLD.pyt<module>s
	PK�
Q\v��	
	
matt/rubber-band-box-demo-1.pycnu�[����
��^c@s7ddlTdefd��YZe�Zej�dS(i����(t*tTestcBsAeZd�Zd�Zd�Zd�Zd�Zdd�ZRS(cCs	dGHdS(Nthi((tself((s@/usr/lib64/python2.7/Demo/tkinter/matt/rubber-band-box-demo-1.pytprintitscCs{t|ddddddddd	|j�|_|jjd
tdt�t|dd
dd
�|_|jjd
t�dS(NttexttQUITt
backgroundtredt
foregroundtwhitetheightitcommandtsidetfilltwidtht5i(	tButtontquitRtpacktBOTTOMtBOTHtCanvastcanvasObjecttLEFT(R((s@/usr/lib64/python2.7/Demo/tkinter/matt/rubber-band-box-demo-1.pyt
createWidgetsscCs4|jj|j�|_|jj|j�|_dS(N(Rtcanvasxtxtstartxtcanvasytytstarty(Rtevent((s@/usr/lib64/python2.7/Demo/tkinter/matt/rubber-band-box-demo-1.pyt	mouseDownscCs�|jj|j�}|jj|j�}|j|jkr�|j|jkr�|jj|j�|jj	|j|j||�|_|j
�ndS(N(RRRRRRRtdeletet
rubberbandBoxtcreate_rectangletupdate_idletasks(RR RR((s@/usr/lib64/python2.7/Demo/tkinter/matt/rubber-band-box-demo-1.pytmouseMotions$	cCs|jj|j�dS(N(RR"R#(RR ((s@/usr/lib64/python2.7/Demo/tkinter/matt/rubber-band-box-demo-1.pytmouseUp'scCstj||�tj|�|j�d|_tj|j	d|j
�tj|j	d|j�tj|j	d|j�dS(Ns
<Button-1>s<Button1-Motion>s<Button1-ButtonRelease>(
tFramet__init__tPacktconfigRtNoneR#tWidgettbindRR!R&R'(Rtmaster((s@/usr/lib64/python2.7/Demo/tkinter/matt/rubber-band-box-demo-1.pyR)*s

	N(	t__name__t
__module__RRR!R&R'R,R)(((s@/usr/lib64/python2.7/Demo/tkinter/matt/rubber-band-box-demo-1.pyRs					N(tTkinterR(Rttesttmainloop(((s@/usr/lib64/python2.7/Demo/tkinter/matt/rubber-band-box-demo-1.pyt<module>s
5	PK�
Q\�>���matt/two-radio-groups.pynu�[���from Tkinter import *

#       The way to think about this is that each radio button menu
#       controls a different variable -- clicking on one of the
#       mutually exclusive choices in a radiobutton assigns some value
#       to an application variable you provide. When you define a
#       radiobutton menu choice, you have the option of specifying the
#       name of a varaible and value to assign to that variable when
#       that choice is selected. This clever mechanism relieves you,
#       the programmer, from having to write a dumb callback that
#       probably wouldn't have done anything more than an assignment
#       anyway. The Tkinter options for this follow their Tk
#       counterparts:
#       {"variable" : my_flavor_variable, "value" : "strawberry"}
#       where my_flavor_variable is an instance of one of the
#       subclasses of Variable, provided in Tkinter.py (there is
#       StringVar(), IntVar(), DoubleVar() and BooleanVar() to choose
#       from)



def makePoliticalParties(var):
    # make menu button
    Radiobutton_button = Menubutton(mBar, text='Political Party',
                                    underline=0)
    Radiobutton_button.pack(side=LEFT, padx='2m')

    # the primary pulldown
    Radiobutton_button.menu = Menu(Radiobutton_button)

    Radiobutton_button.menu.add_radiobutton(label='Republican',
                                            variable=var, value=1)

    Radiobutton_button.menu.add('radiobutton', {'label': 'Democrat',
                                                'variable' : var,
                                                'value' : 2})

    Radiobutton_button.menu.add('radiobutton', {'label': 'Libertarian',
                                                'variable' : var,
                                                'value' : 3})

    var.set(2)

    # set up a pointer from the file menubutton back to the file menu
    Radiobutton_button['menu'] = Radiobutton_button.menu

    return Radiobutton_button


def makeFlavors(var):
    # make menu button
    Radiobutton_button = Menubutton(mBar, text='Flavors',
                                    underline=0)
    Radiobutton_button.pack(side=LEFT, padx='2m')

    # the primary pulldown
    Radiobutton_button.menu = Menu(Radiobutton_button)

    Radiobutton_button.menu.add_radiobutton(label='Strawberry',
                                            variable=var, value='Strawberry')

    Radiobutton_button.menu.add_radiobutton(label='Chocolate',
                                            variable=var, value='Chocolate')

    Radiobutton_button.menu.add_radiobutton(label='Rocky Road',
                                            variable=var, value='Rocky Road')

    # choose a default
    var.set("Chocolate")

    # set up a pointer from the file menubutton back to the file menu
    Radiobutton_button['menu'] = Radiobutton_button.menu

    return Radiobutton_button


def printStuff():
    print "party is", party.get()
    print "flavor is", flavor.get()
    print

#################################################
#### Main starts here ...
root = Tk()


# make a menu bar
mBar = Frame(root, relief=RAISED, borderwidth=2)
mBar.pack(fill=X)

# make two application variables,
# one to control each radio button set
party = IntVar()
flavor = StringVar()

Radiobutton_button = makePoliticalParties(party)
Radiobutton_button2 = makeFlavors(flavor)

# finally, install the buttons in the menu bar.
# This allows for scanning from one menubutton to the next.
mBar.tk_menuBar(Radiobutton_button, Radiobutton_button2)

b = Button(root, text="print party and flavor", foreground="red",
           command=printStuff)
b.pack(side=TOP)

root.title('menu demo')
root.iconname('menu demo')

root.mainloop()
PK�
Q\�	��NNmatt/canvas-moving-w-mouse.pynu�[���from Tkinter import *

# this file demonstrates the movement of a single canvas item under mouse control

class Test(Frame):
    ###################################################################
    ###### Event callbacks for THE CANVAS (not the stuff drawn on it)
    ###################################################################
    def mouseDown(self, event):
        # remember where the mouse went down
        self.lastx = event.x
        self.lasty = event.y

    def mouseMove(self, event):
        # whatever the mouse is over gets tagged as CURRENT for free by tk.
        self.draw.move(CURRENT, event.x - self.lastx, event.y - self.lasty)
        self.lastx = event.x
        self.lasty = event.y

    ###################################################################
    ###### Event callbacks for canvas ITEMS (stuff drawn on the canvas)
    ###################################################################
    def mouseEnter(self, event):
        # the CURRENT tag is applied to the object the cursor is over.
        # this happens automatically.
        self.draw.itemconfig(CURRENT, fill="red")

    def mouseLeave(self, event):
        # the CURRENT tag is applied to the object the cursor is over.
        # this happens automatically.
        self.draw.itemconfig(CURRENT, fill="blue")

    def createWidgets(self):
        self.QUIT = Button(self, text='QUIT', foreground='red',
                           command=self.quit)
        self.QUIT.pack(side=LEFT, fill=BOTH)
        self.draw = Canvas(self, width="5i", height="5i")
        self.draw.pack(side=LEFT)

        fred = self.draw.create_oval(0, 0, 20, 20,
                                     fill="green", tags="selected")

        self.draw.tag_bind(fred, "<Any-Enter>", self.mouseEnter)
        self.draw.tag_bind(fred, "<Any-Leave>", self.mouseLeave)

        Widget.bind(self.draw, "<1>", self.mouseDown)
        Widget.bind(self.draw, "<B1-Motion>", self.mouseMove)

    def __init__(self, master=None):
        Frame.__init__(self, master)
        Pack.config(self)
        self.createWidgets()

test = Test()
test.mainloop()
PK�
Q\�� �yy!matt/bind-w-mult-calls-p-type.pyonu�[����
��^c@sSddlTddlZdefd��YZe�Zejjd�ej�dS(i����(t*NtAppcBs&eZdd�Zd�Zd�ZRS(cCsftj||�|j�t�|_|jj�|jjd|j�|jjd|jd�dS(Ns<Key-Return>t+(tFramet__init__tpacktEntrytentrythingytbindtprint_contentstprint_something_else(tselftmaster((sB/usr/lib64/python2.7/Demo/tkinter/matt/bind-w-mult-calls-p-type.pyRs

cCsdG|jj�GHdS(Ns"hi. contents of entry is now ---->(Rtget(Rtevent((sB/usr/lib64/python2.7/Demo/tkinter/matt/bind-w-mult-calls-p-type.pyR	scCs	dGHdS(Ns,hi. Now doing something completely different((RR((sB/usr/lib64/python2.7/Demo/tkinter/matt/bind-w-mult-calls-p-type.pyR
sN(t__name__t
__module__tNoneRR	R
(((sB/usr/lib64/python2.7/Demo/tkinter/matt/bind-w-mult-calls-p-type.pyRs	tFoo(tTkintertstringRRtrootRttitletmainloop(((sB/usr/lib64/python2.7/Demo/tkinter/matt/bind-w-mult-calls-p-type.pyt<module>s

	PK�
Q\3��(jjmatt/window-creation-simple.pycnu�[����
��^c@s7ddlTdefd��YZe�Zej�dS(i����(t*tTestcBs/eZd�Zd�Zd�Zdd�ZRS(cCs	dGHdS(Nthi((tself((s@/usr/lib64/python2.7/Demo/tkinter/matt/window-creation-simple.pytprintitscCs/t�}t|dd�|_|jj�dS(NttextsHere's a new window(tTopleveltLabeltlabeltpack(Rtfred((s@/usr/lib64/python2.7/Demo/tkinter/matt/window-creation-simple.pyt
makeWindow	s	cCsrt|ddddd|j�|_|jjdtdt�t|ddd|j�|_|jjdt�dS(	NRtQUITt
foregroundtredtcommandtsidetfillsMake a New Window(tButtontquitRR	tLEFTtBOTHRthi_there(R((s@/usr/lib64/python2.7/Demo/tkinter/matt/window-creation-simple.pyt
createWidgetsscCs+tj||�tj|�|j�dS(N(tFramet__init__tPacktconfigR(Rtmaster((s@/usr/lib64/python2.7/Demo/tkinter/matt/window-creation-simple.pyRs
N(t__name__t
__module__RRRtNoneR(((s@/usr/lib64/python2.7/Demo/tkinter/matt/window-creation-simple.pyRs			N(tTkinterRRttesttmainloop(((s@/usr/lib64/python2.7/Demo/tkinter/matt/window-creation-simple.pyt<module>s
	PK�
Q\�J����matt/radiobutton-simple.pynu�[���from Tkinter import *

# This is a demo program that shows how to
# create radio buttons and how to get other widgets to
# share the information in a radio button.
#
# There are other ways of doing this too, but
# the "variable" option of radiobuttons seems to be the easiest.
#
# note how each button has a value it sets the variable to as it gets hit.


class Test(Frame):
    def printit(self):
        print "hi"

    def createWidgets(self):

        self.flavor = StringVar()
        self.flavor.set("chocolate")

        self.radioframe = Frame(self)
        self.radioframe.pack()

        # 'text' is the label
        # 'variable' is the name of the variable that all these radio buttons share
        # 'value' is the value this variable takes on when the radio button is selected
        # 'anchor' makes the text appear left justified (default is centered. ick)
        self.radioframe.choc = Radiobutton(
            self.radioframe, text="Chocolate Flavor",
            variable=self.flavor, value="chocolate",
            anchor=W)
        self.radioframe.choc.pack(fill=X)

        self.radioframe.straw = Radiobutton(
            self.radioframe, text="Strawberry Flavor",
            variable=self.flavor, value="strawberry",
            anchor=W)
        self.radioframe.straw.pack(fill=X)

        self.radioframe.lemon = Radiobutton(
            self.radioframe, text="Lemon Flavor",
            variable=self.flavor, value="lemon",
            anchor=W)
        self.radioframe.lemon.pack(fill=X)

        # this is a text entry that lets you type in the name of a flavor too.
        self.entry = Entry(self, textvariable=self.flavor)
        self.entry.pack(fill=X)
        self.QUIT = Button(self, text='QUIT', foreground='red',
                           command=self.quit)
        self.QUIT.pack(side=BOTTOM, fill=BOTH)


    def __init__(self, master=None):
        Frame.__init__(self, master)
        Pack.config(self)
        self.createWidgets()

test = Test()

test.mainloop()
PK�
Q\��)��matt/canvas-reading-tag-info.pynu�[���from Tkinter import *


class Test(Frame):
    def printit(self):
        print "hi"

    def createWidgets(self):
        self.QUIT = Button(self, text='QUIT', foreground='red',
                           command=self.quit)
        self.QUIT.pack(side=BOTTOM, fill=BOTH)

        self.drawing = Canvas(self, width="5i", height="5i")

        # make a shape
        pgon = self.drawing.create_polygon(
            10, 10, 110, 10, 110, 110, 10 , 110,
            fill="red", tags=("weee", "foo", "groo"))

        # this is how you query an object for its attributes
        # config options FOR CANVAS ITEMS always come back in tuples of length 5.
        # 0 attribute name
        # 1 BLANK
        # 2 BLANK
        # 3 default value
        # 4 current value
        # the blank spots are for consistency with the config command that
        # is used for widgets. (remember, this is for ITEMS drawn
        # on a canvas widget, not widgets)
        option_value = self.drawing.itemconfig(pgon, "stipple")
        print "pgon's current stipple value is -->", option_value[4], "<--"
        option_value = self.drawing.itemconfig(pgon,  "fill")
        print "pgon's current fill value is -->", option_value[4], "<--"
        print "  when he is usually colored -->", option_value[3], "<--"

        ## here we print out all the tags associated with this object
        option_value = self.drawing.itemconfig(pgon,  "tags")
        print "pgon's tags are", option_value[4]

        self.drawing.pack(side=LEFT)

    def __init__(self, master=None):
        Frame.__init__(self, master)
        Pack.config(self)
        self.createWidgets()

test = Test()

test.mainloop()
PK�
Q\�		matt/canvas-gridding.pyonu�[����
��^c@s7ddlTdefd��YZe�Zej�dS(i����(t*tTestcBs8eZd�Zd�Zd�Zd�Zdd�ZRS(cCs	dGHdS(Nthi((tself((s9/usr/lib64/python2.7/Demo/tkinter/matt/canvas-gridding.pytprintit	scCs{t|ddddddddd	|j�|_|jjd
tdt�t|dd
dd
�|_|jjd
t�dS(NttexttQUITt
backgroundtredt
foregroundtwhitetheightitcommandtsidetfilltwidtht5i(	tButtontquitRtpacktBOTTOMtBOTHtCanvastcanvasObjecttLEFT(R((s9/usr/lib64/python2.7/Demo/tkinter/matt/canvas-gridding.pyt
createWidgetsscCs@|jj|j|j�|_|jj|j|j�|_dS(N(RtcanvasxtxtgriddingSizetstartxtcanvasytytstarty(Rtevent((s9/usr/lib64/python2.7/Demo/tkinter/matt/canvas-gridding.pyt	mouseDownscCs�|jj|j|j�}|jj|j|j�}|j|jkr�|j|jkr�|jj|j	�|jj
|j|j||�|_	|j�ndS(N(RRRRRRRR tdeletet
rubberbandBoxtcreate_rectangletupdate_idletasks(RR!RR((s9/usr/lib64/python2.7/Demo/tkinter/matt/canvas-gridding.pytmouseMotions$	cCsotj||�tj|�|j�d|_d|_tj	|j
d|j�tj	|j
d|j�dS(Ni2s
<Button-1>s<Button1-Motion>(
tFramet__init__tPacktconfigRtNoneR$RtWidgettbindRR"R'(Rtmaster((s9/usr/lib64/python2.7/Demo/tkinter/matt/canvas-gridding.pyR),s

		N(t__name__t
__module__RRR"R'R,R)(((s9/usr/lib64/python2.7/Demo/tkinter/matt/canvas-gridding.pyRs
				N(tTkinterR(Rttesttmainloop(((s9/usr/lib64/python2.7/Demo/tkinter/matt/canvas-gridding.pyt<module>s
3	PK�
Q\��gmatt/00-HELLO-WORLD.pycnu�[����
��^c@s7ddlTdefd��YZe�Zej�dS(i����(t*tTestcBs&eZd�Zd�Zdd�ZRS(cCs	dGHdS(Nthi((tself((s8/usr/lib64/python2.7/Demo/tkinter/matt/00-HELLO-WORLD.pytprintitscCsrt|ddddd|j�|_|jjdtdt�t|ddd|j�|_|jjdt�dS(	NttexttQUITt
foregroundtredtcommandtsidetfilltHello(tButtontquitRtpacktLEFTtBOTHRthi_there(R((s8/usr/lib64/python2.7/Demo/tkinter/matt/00-HELLO-WORLD.pyt
createWidgets
scCs+tj||�tj|�|j�dS(N(tFramet__init__tPacktconfigR(Rtmaster((s8/usr/lib64/python2.7/Demo/tkinter/matt/00-HELLO-WORLD.pyRs
N(t__name__t
__module__RRtNoneR(((s8/usr/lib64/python2.7/Demo/tkinter/matt/00-HELLO-WORLD.pyRs		N(tTkinterRRttesttmainloop(((s8/usr/lib64/python2.7/Demo/tkinter/matt/00-HELLO-WORLD.pyt<module>s
	PK�
Q\����PPmatt/pong-demo-1.pycnu�[����
��^c@sCddlTddlZdefd��YZe�Zej�dS(i����(t*NtPongcBs&eZd�Zd�Zdd�ZRS(c
Cs�t|ddddd|j�|_|jjdtdt�t|dd	d
d	�|_t|dt	dd
dddd�|_
|j
jdtdt�|jj
dddddd�|_d|_d|_d|_d|_|jjdt�dS(NttexttQUITt
foregroundtredtcommandtsidetfilltwidtht5itheighttorienttlabels
ball speedtfrom_i����ttoidt0is0.10ig�������?g333333�?g�?(tButtontquitRtpacktLEFTtBOTHtCanvastdrawtScalet
HORIZONTALtspeedtBOTTOMtXtcreate_ovaltballtxtyt
velocity_xt
velocity_y(tself((s5/usr/lib64/python2.7/Demo/tkinter/matt/pong-demo-1.pyt
createWidgetss				cGs�|jdks|jdkr1d|j|_n|jdksO|jdkrbd|j|_n|j|jj�d}|j|jj�d}|j||_|j||_|jj|jd|d|�|j	d|j
�dS(Ng@gg�gY@s%rii
(RR!R R"RtgetRtmoveRtaftertmoveBall(R#targstdeltaxtdeltay((s5/usr/lib64/python2.7/Demo/tkinter/matt/pong-demo-1.pyR(s!cCs>tj||�tj|�|j�|jd|j�dS(Ni
(tFramet__init__tPacktconfigR$R'R((R#tmaster((s5/usr/lib64/python2.7/Demo/tkinter/matt/pong-demo-1.pyR--s

N(t__name__t
__module__R$R(tNoneR-(((s5/usr/lib64/python2.7/Demo/tkinter/matt/pong-demo-1.pyRs		(tTkintertstringR,Rtgametmainloop(((s5/usr/lib64/python2.7/Demo/tkinter/matt/pong-demo-1.pyt<module>s
.	PK�
Q\�		matt/canvas-gridding.pycnu�[����
��^c@s7ddlTdefd��YZe�Zej�dS(i����(t*tTestcBs8eZd�Zd�Zd�Zd�Zdd�ZRS(cCs	dGHdS(Nthi((tself((s9/usr/lib64/python2.7/Demo/tkinter/matt/canvas-gridding.pytprintit	scCs{t|ddddddddd	|j�|_|jjd
tdt�t|dd
dd
�|_|jjd
t�dS(NttexttQUITt
backgroundtredt
foregroundtwhitetheightitcommandtsidetfilltwidtht5i(	tButtontquitRtpacktBOTTOMtBOTHtCanvastcanvasObjecttLEFT(R((s9/usr/lib64/python2.7/Demo/tkinter/matt/canvas-gridding.pyt
createWidgetsscCs@|jj|j|j�|_|jj|j|j�|_dS(N(RtcanvasxtxtgriddingSizetstartxtcanvasytytstarty(Rtevent((s9/usr/lib64/python2.7/Demo/tkinter/matt/canvas-gridding.pyt	mouseDownscCs�|jj|j|j�}|jj|j|j�}|j|jkr�|j|jkr�|jj|j	�|jj
|j|j||�|_	|j�ndS(N(RRRRRRRR tdeletet
rubberbandBoxtcreate_rectangletupdate_idletasks(RR!RR((s9/usr/lib64/python2.7/Demo/tkinter/matt/canvas-gridding.pytmouseMotions$	cCsotj||�tj|�|j�d|_d|_tj	|j
d|j�tj	|j
d|j�dS(Ni2s
<Button-1>s<Button1-Motion>(
tFramet__init__tPacktconfigRtNoneR$RtWidgettbindRR"R'(Rtmaster((s9/usr/lib64/python2.7/Demo/tkinter/matt/canvas-gridding.pyR),s

		N(t__name__t
__module__RRR"R'R,R)(((s9/usr/lib64/python2.7/Demo/tkinter/matt/canvas-gridding.pyRs
				N(tTkinterR(Rttesttmainloop(((s9/usr/lib64/python2.7/Demo/tkinter/matt/canvas-gridding.pyt<module>s
3	PK�
Q\���'��matt/canvas-gridding.pynu�[���from Tkinter import *

# this is the same as simple-demo-1.py, but uses
# subclassing.
# note that there is no explicit call to start Tk.
# Tkinter is smart enough to start the system if it's not already going.

class Test(Frame):
    def printit(self):
        print "hi"

    def createWidgets(self):
        self.QUIT = Button(self, text='QUIT',
                                  background='red',
                                  foreground='white',
                                  height=3,
                                  command=self.quit)
        self.QUIT.pack(side=BOTTOM, fill=BOTH)

        self.canvasObject = Canvas(self, width="5i", height="5i")
        self.canvasObject.pack(side=LEFT)

    def mouseDown(self, event):
        # canvas x and y take the screen coords from the event and translate
        # them into the coordinate system of the canvas object
        self.startx = self.canvasObject.canvasx(event.x, self.griddingSize)
        self.starty = self.canvasObject.canvasy(event.y, self.griddingSize)

    def mouseMotion(self, event):
        # canvas x and y take the screen coords from the event and translate
        # them into the coordinate system of the canvas object
        x = self.canvasObject.canvasx(event.x, self.griddingSize)
        y = self.canvasObject.canvasy(event.y, self.griddingSize)

        if (self.startx != event.x)  and (self.starty != event.y) :
            self.canvasObject.delete(self.rubberbandBox)
            self.rubberbandBox = self.canvasObject.create_rectangle(
                self.startx, self.starty, x, y)
            # this flushes the output, making sure that
            # the rectangle makes it to the screen
            # before the next event is handled
            self.update_idletasks()

    def __init__(self, master=None):
        Frame.__init__(self, master)
        Pack.config(self)
        self.createWidgets()

        # this is a "tagOrId" for the rectangle we draw on the canvas
        self.rubberbandBox = None

        # this is the size of the gridding squares
        self.griddingSize = 50

        Widget.bind(self.canvasObject, "<Button-1>", self.mouseDown)
        Widget.bind(self.canvasObject, "<Button1-Motion>", self.mouseMotion)


test = Test()

test.mainloop()
PK�
Q\�f� 44#matt/window-creation-w-location.pyonu�[����
��^c@sYddlTddlZdefd��YZdefd��YZe�Zej�dS(i����(t*Nt
QuitButtoncBseZd�ZRS(cOs\|jd�sd|d<n|jd�s;|j|d<nttj||f||�dS(NttexttQUITtcommand(thas_keytquittapplytButtont__init__(tselftmastertargstkwargs((sD/usr/lib64/python2.7/Demo/tkinter/matt/window-creation-w-location.pyR	s

(t__name__t
__module__R	(((sD/usr/lib64/python2.7/Demo/tkinter/matt/window-creation-w-location.pyR
stTestcBs&eZd�Zd�Zdd�ZRS(cGsgt�}t|dddd�|_|jjdddd�|jjdddd�|jj�dS(Ntwidtht2itheightt0(tTopleveltCanvastlabeltcreate_linetpack(R
Rtfred((sD/usr/lib64/python2.7/Demo/tkinter/matt/window-creation-w-location.pyt
makeWindows
	c
Csit|�|_|jjdtdt�t|ddddddd	|j�|_|jjdt�dS(
NtsidetfillRsMake a New WindowRi2RiR(RRRtLEFTtBOTHRR(R
((sD/usr/lib64/python2.7/Demo/tkinter/matt/window-creation-w-location.pyt
createWidgetsscCs+tj||�tj|�|j�dS(N(tFrameR	tPacktconfigR (R
R((sD/usr/lib64/python2.7/Demo/tkinter/matt/window-creation-w-location.pyR	's
N(RRRR tNoneR	(((sD/usr/lib64/python2.7/Demo/tkinter/matt/window-creation-w-location.pyRs			(tTkintertsysRRR!Rttesttmainloop(((sD/usr/lib64/python2.7/Demo/tkinter/matt/window-creation-w-location.pyt<module>s

	PK�
Q\v��	
	
matt/rubber-band-box-demo-1.pyonu�[����
��^c@s7ddlTdefd��YZe�Zej�dS(i����(t*tTestcBsAeZd�Zd�Zd�Zd�Zd�Zdd�ZRS(cCs	dGHdS(Nthi((tself((s@/usr/lib64/python2.7/Demo/tkinter/matt/rubber-band-box-demo-1.pytprintitscCs{t|ddddddddd	|j�|_|jjd
tdt�t|dd
dd
�|_|jjd
t�dS(NttexttQUITt
backgroundtredt
foregroundtwhitetheightitcommandtsidetfilltwidtht5i(	tButtontquitRtpacktBOTTOMtBOTHtCanvastcanvasObjecttLEFT(R((s@/usr/lib64/python2.7/Demo/tkinter/matt/rubber-band-box-demo-1.pyt
createWidgetsscCs4|jj|j�|_|jj|j�|_dS(N(Rtcanvasxtxtstartxtcanvasytytstarty(Rtevent((s@/usr/lib64/python2.7/Demo/tkinter/matt/rubber-band-box-demo-1.pyt	mouseDownscCs�|jj|j�}|jj|j�}|j|jkr�|j|jkr�|jj|j�|jj	|j|j||�|_|j
�ndS(N(RRRRRRRtdeletet
rubberbandBoxtcreate_rectangletupdate_idletasks(RR RR((s@/usr/lib64/python2.7/Demo/tkinter/matt/rubber-band-box-demo-1.pytmouseMotions$	cCs|jj|j�dS(N(RR"R#(RR ((s@/usr/lib64/python2.7/Demo/tkinter/matt/rubber-band-box-demo-1.pytmouseUp'scCstj||�tj|�|j�d|_tj|j	d|j
�tj|j	d|j�tj|j	d|j�dS(Ns
<Button-1>s<Button1-Motion>s<Button1-ButtonRelease>(
tFramet__init__tPacktconfigRtNoneR#tWidgettbindRR!R&R'(Rtmaster((s@/usr/lib64/python2.7/Demo/tkinter/matt/rubber-band-box-demo-1.pyR)*s

	N(	t__name__t
__module__RRR!R&R'R,R)(((s@/usr/lib64/python2.7/Demo/tkinter/matt/rubber-band-box-demo-1.pyRs					N(tTkinterR(Rttesttmainloop(((s@/usr/lib64/python2.7/Demo/tkinter/matt/rubber-band-box-demo-1.pyt<module>s
5	PK�
Q\S�"

matt/placer-simple.pyonu�[����
��^c@seddlTd�Zd�Zd�Ze�Zee�Zejd�ejdd�ej	�dS(i����(t*cCs#tjjd|jd|j�dS(Ntxty(tapptbuttontplaceRR(tevent((s7/usr/lib64/python2.7/Demo/tkinter/matt/placer-simple.pyt	do_motionscCs	dGHdS(Nscalling me!((((s7/usr/lib64/python2.7/Demo/tkinter/matt/placer-simple.pytdothisscCs�t|dddddd�}|jdddd�t|d	d
ddd
t�|_|jjdddddt�|jdt�|S(Ntwidthi�theightt
backgroundtgreentrelxgtrelyt
foregroundtredttexttamazingtcommandg�?tanchors<Control-Shift-Motion>(tFrameRtButtonRRtNWtbindR(ttoptf((s7/usr/lib64/python2.7/Demo/tkinter/matt/placer-simple.pyt
createWidgetss!t400x400i�N(
tTkinterRRRtTktrootRtgeometrytmaxsizetmainloop(((s7/usr/lib64/python2.7/Demo/tkinter/matt/placer-simple.pyt<module>s
				
PK�
Q\��aI

"matt/canvas-moving-or-creating.pyonu�[����
��^c@s7ddlTdefd��YZe�Zej�dS(i����(t*tTestcBsAeZd�Zd�Zd�Zd�Zd�Zdd�ZRS(c	Cs�|jjt�s�|jj|jd|jd|jd|jddddt�}|jj|d|j�|jj|d|j	�n|j|_
|j|_dS(Ni
tfilltgreenttagss<Any-Enter>s<Any-Leave>(twidgettfind_withtagtCURRENTtdrawtcreate_ovaltxtyttag_bindt
mouseEntert
mouseLeavetlastxtlasty(tselfteventtfred((sC/usr/lib64/python2.7/Demo/tkinter/matt/canvas-moving-or-creating.pyt	mouseDown
s	+cCsF|jjt|j|j|j|j�|j|_|j|_dS(N(RtmoveRR
RRR(RR((sC/usr/lib64/python2.7/Demo/tkinter/matt/canvas-moving-or-creating.pyt	mouseMoves*cCs|jjtdd�dS(NRtred(Rt
itemconfigR(RR((sC/usr/lib64/python2.7/Demo/tkinter/matt/canvas-moving-or-creating.pyR
$scCs|jjtdd�dS(NRtblue(RRR(RR((sC/usr/lib64/python2.7/Demo/tkinter/matt/canvas-moving-or-creating.pyR)scCs�t|ddddd|j�|_|jjdtdt�t|dd	d
d	�|_|jjdt�tj	|jd|j
�tj	|jd|j�dS(
NttexttQUITt
foregroundRtcommandtsideRtwidtht5itheights<1>s<B1-Motion>(tButtontquitRtpacktLEFTtBOTHtCanvasRtWidgettbindRR(R((sC/usr/lib64/python2.7/Demo/tkinter/matt/canvas-moving-or-creating.pyt
createWidgets.scCs+tj||�tj|�|j�dS(N(tFramet__init__tPacktconfigR*(Rtmaster((sC/usr/lib64/python2.7/Demo/tkinter/matt/canvas-moving-or-creating.pyR,8s
N(	t__name__t
__module__RRR
RR*tNoneR,(((sC/usr/lib64/python2.7/Demo/tkinter/matt/canvas-moving-or-creating.pyRs					
N(tTkinterR+Rttesttmainloop(((sC/usr/lib64/python2.7/Demo/tkinter/matt/canvas-moving-or-creating.pyt<module>s
7	PK�
Q\#~���"matt/entry-with-shared-variable.pynu�[���from Tkinter import *
import string

# This program  shows how to make a typein box shadow a program variable.

class App(Frame):
    def __init__(self, master=None):
        Frame.__init__(self, master)
        self.pack()

        self.entrythingy = Entry(self)
        self.entrythingy.pack()

        self.button = Button(self, text="Uppercase The Entry",
                             command=self.upper)
        self.button.pack()

        # here we have the text in the entry widget tied to a variable.
        # changes in the variable are echoed in the widget and vice versa.
        # Very handy.
        # there are other Variable types. See Tkinter.py for all
        # the other variable types that can be shadowed
        self.contents = StringVar()
        self.contents.set("this is a variable")
        self.entrythingy.config(textvariable=self.contents)

        # and here we get a callback when the user hits return. we could
        # make the key that triggers the callback anything we wanted to.
        # other typical options might be <Key-Tab> or <Key> (for anything)
        self.entrythingy.bind('<Key-Return>', self.print_contents)

    def upper(self):
        # notice here, we don't actually refer to the entry box.
        # we just operate on the string variable and we
        # because it's being looked at by the entry widget, changing
        # the variable changes the entry widget display automatically.
        # the strange get/set operators are clunky, true...
        str = string.upper(self.contents.get())
        self.contents.set(str)

    def print_contents(self, event):
        print "hi. contents of entry is now ---->", self.contents.get()

root = App()
root.master.title("Foo")
root.mainloop()
PK�
Q\�X
���"matt/packer-and-placer-together.pynu�[���from Tkinter import *

# This is a program that tests the placer geom manager in conjunction with
# the packer. The background (green) is packed, while the widget inside is placed


def do_motion(event):
    app.button.place(x=event.x, y=event.y)

def dothis():
    print 'calling me!'

def createWidgets(top):
    # make a frame. Note that the widget is 200 x 200
    # and the window containing is 400x400. We do this
    # simply to show that this is possible. The rest of the
    # area is inaccesssible.
    f = Frame(top, width=200, height=200, background='green')

    # note that we use a different manager here.
    # This way, the top level frame widget resizes when the
    # application window does.
    f.pack(fill=BOTH, expand=1)

    # now make a button
    f.button = Button(f, foreground='red', text='amazing', command=dothis)

    # and place it so that the nw corner is
    # 1/2 way along the top X edge of its' parent
    f.button.place(relx=0.5, rely=0.0, anchor=NW)

    # allow the user to move the button SUIT-style.
    f.bind('<Control-Shift-Motion>', do_motion)

    return f

root = Tk()
app = createWidgets(root)
root.geometry("400x400")
root.maxsize(1000, 1000)
root.mainloop()
PK�
Q\�P6��matt/slider-demo-1.pynu�[���from Tkinter import *

# shows how to make a slider, set and get its value under program control


class Test(Frame):
    def print_value(self, val):
        print "slider now at", val

    def reset(self):
        self.slider.set(0)

    def createWidgets(self):
        self.slider = Scale(self, from_=0, to=100,
                            orient=HORIZONTAL,
                            length="3i",
                            label="happy slider",
                            command=self.print_value)

        self.reset = Button(self, text='reset slider',
                            command=self.reset)

        self.QUIT = Button(self, text='QUIT', foreground='red',
                           command=self.quit)

        self.slider.pack(side=LEFT)
        self.reset.pack(side=LEFT)
        self.QUIT.pack(side=LEFT, fill=BOTH)

    def __init__(self, master=None):
        Frame.__init__(self, master)
        Pack.config(self)
        self.createWidgets()

test = Test()
test.mainloop()
PK�
Q\����PPmatt/pong-demo-1.pyonu�[����
��^c@sCddlTddlZdefd��YZe�Zej�dS(i����(t*NtPongcBs&eZd�Zd�Zdd�ZRS(c
Cs�t|ddddd|j�|_|jjdtdt�t|dd	d
d	�|_t|dt	dd
dddd�|_
|j
jdtdt�|jj
dddddd�|_d|_d|_d|_d|_|jjdt�dS(NttexttQUITt
foregroundtredtcommandtsidetfilltwidtht5itheighttorienttlabels
ball speedtfrom_i����ttoidt0is0.10ig�������?g333333�?g�?(tButtontquitRtpacktLEFTtBOTHtCanvastdrawtScalet
HORIZONTALtspeedtBOTTOMtXtcreate_ovaltballtxtyt
velocity_xt
velocity_y(tself((s5/usr/lib64/python2.7/Demo/tkinter/matt/pong-demo-1.pyt
createWidgetss				cGs�|jdks|jdkr1d|j|_n|jdksO|jdkrbd|j|_n|j|jj�d}|j|jj�d}|j||_|j||_|jj|jd|d|�|j	d|j
�dS(Ng@gg�gY@s%rii
(RR!R R"RtgetRtmoveRtaftertmoveBall(R#targstdeltaxtdeltay((s5/usr/lib64/python2.7/Demo/tkinter/matt/pong-demo-1.pyR(s!cCs>tj||�tj|�|j�|jd|j�dS(Ni
(tFramet__init__tPacktconfigR$R'R((R#tmaster((s5/usr/lib64/python2.7/Demo/tkinter/matt/pong-demo-1.pyR--s

N(t__name__t
__module__R$R(tNoneR-(((s5/usr/lib64/python2.7/Demo/tkinter/matt/pong-demo-1.pyRs		(tTkintertstringR,Rtgametmainloop(((s5/usr/lib64/python2.7/Demo/tkinter/matt/pong-demo-1.pyt<module>s
.	PK�
Q\����matt/canvas-w-widget-draw-el.pynu�[���from Tkinter import *

# this file demonstrates the creation of widgets as part of a canvas object

class Test(Frame):
    def printhi(self):
        print "hi"

    def createWidgets(self):
        self.QUIT = Button(self, text='QUIT', foreground='red',
                           command=self.quit)
        self.QUIT.pack(side=BOTTOM, fill=BOTH)

        self.draw = Canvas(self, width="5i", height="5i")

        self.button = Button(self, text="this is a button",
                             command=self.printhi)

        # note here the coords are given in pixels (form the
        # upper right and corner of the window, as usual for X)
        # but might just have well been given in inches or points or
        # whatever...use the "anchor" option to control what point of the
        # widget (in this case the button) gets mapped to the given x, y.
        # you can specify corners, edges, center, etc...
        self.draw.create_window(300, 300, window=self.button)

        self.draw.pack(side=LEFT)

    def __init__(self, master=None):
        Frame.__init__(self, master)
        Pack.config(self)
        self.createWidgets()

test = Test()

test.mainloop()
PK�
Q\S�"

matt/placer-simple.pycnu�[����
��^c@seddlTd�Zd�Zd�Ze�Zee�Zejd�ejdd�ej	�dS(i����(t*cCs#tjjd|jd|j�dS(Ntxty(tapptbuttontplaceRR(tevent((s7/usr/lib64/python2.7/Demo/tkinter/matt/placer-simple.pyt	do_motionscCs	dGHdS(Nscalling me!((((s7/usr/lib64/python2.7/Demo/tkinter/matt/placer-simple.pytdothisscCs�t|dddddd�}|jdddd�t|d	d
ddd
t�|_|jjdddddt�|jdt�|S(Ntwidthi�theightt
backgroundtgreentrelxgtrelyt
foregroundtredttexttamazingtcommandg�?tanchors<Control-Shift-Motion>(tFrameRtButtonRRtNWtbindR(ttoptf((s7/usr/lib64/python2.7/Demo/tkinter/matt/placer-simple.pyt
createWidgetss!t400x400i�N(
tTkinterRRRtTktrootRtgeometrytmaxsizetmainloop(((s7/usr/lib64/python2.7/Demo/tkinter/matt/placer-simple.pyt<module>s
				
PK�
Q\��aI

"matt/canvas-moving-or-creating.pycnu�[����
��^c@s7ddlTdefd��YZe�Zej�dS(i����(t*tTestcBsAeZd�Zd�Zd�Zd�Zd�Zdd�ZRS(c	Cs�|jjt�s�|jj|jd|jd|jd|jddddt�}|jj|d|j�|jj|d|j	�n|j|_
|j|_dS(Ni
tfilltgreenttagss<Any-Enter>s<Any-Leave>(twidgettfind_withtagtCURRENTtdrawtcreate_ovaltxtyttag_bindt
mouseEntert
mouseLeavetlastxtlasty(tselfteventtfred((sC/usr/lib64/python2.7/Demo/tkinter/matt/canvas-moving-or-creating.pyt	mouseDown
s	+cCsF|jjt|j|j|j|j�|j|_|j|_dS(N(RtmoveRR
RRR(RR((sC/usr/lib64/python2.7/Demo/tkinter/matt/canvas-moving-or-creating.pyt	mouseMoves*cCs|jjtdd�dS(NRtred(Rt
itemconfigR(RR((sC/usr/lib64/python2.7/Demo/tkinter/matt/canvas-moving-or-creating.pyR
$scCs|jjtdd�dS(NRtblue(RRR(RR((sC/usr/lib64/python2.7/Demo/tkinter/matt/canvas-moving-or-creating.pyR)scCs�t|ddddd|j�|_|jjdtdt�t|dd	d
d	�|_|jjdt�tj	|jd|j
�tj	|jd|j�dS(
NttexttQUITt
foregroundRtcommandtsideRtwidtht5itheights<1>s<B1-Motion>(tButtontquitRtpacktLEFTtBOTHtCanvasRtWidgettbindRR(R((sC/usr/lib64/python2.7/Demo/tkinter/matt/canvas-moving-or-creating.pyt
createWidgets.scCs+tj||�tj|�|j�dS(N(tFramet__init__tPacktconfigR*(Rtmaster((sC/usr/lib64/python2.7/Demo/tkinter/matt/canvas-moving-or-creating.pyR,8s
N(	t__name__t
__module__RRR
RR*tNoneR,(((sC/usr/lib64/python2.7/Demo/tkinter/matt/canvas-moving-or-creating.pyRs					
N(tTkinterR+Rttesttmainloop(((sC/usr/lib64/python2.7/Demo/tkinter/matt/canvas-moving-or-creating.pyt<module>s
7	PK�
Q\R��۩�matt/menu-simple.pycnu�[����
��^c@s�ddlTd�Zd�Zd�Zd�Ze�Zeededd�Z	e	j
d	e�e�Ze�Z
e	jee
�ejd
�ejd�ej�dS(
i����(t*cCs	dGHdS(Nsopening new file((((s5/usr/lib64/python2.7/Demo/tkinter/matt/menu-simple.pytnew_file$scCs	dGHdS(Nsopening OLD file((((s5/usr/lib64/python2.7/Demo/tkinter/matt/menu-simple.pyt	open_file(scCs�ttdddd�}|jdtdd�t|�|_|jjdd	ddd
t�|jjddddd
t�|jjddddd
d
�|j|d<|S(NttexttFilet	underlineitsidetpadxt1mtlabelsNew...tcommandsOpen...tQuittexittmenu(	t
MenubuttontmBartpacktLEFTtMenuR
tadd_commandRR(tFile_button((s5/usr/lib64/python2.7/Demo/tkinter/matt/menu-simple.pytmakeFileMenu,s
cCs�ttdddd�}|jdtdd�t|�|_|jjdd	d
�|jjddt�|jj	d	d
�|jj	d	d�|jj	d	d�|j|d<|S(NRtEditRiRRRR
R	tUndoitstatetCuttCopytPasteR
(
RRRRRR
taddtentryconfigtDISABLEDR(tEdit_button((s5/usr/lib64/python2.7/Demo/tkinter/matt/menu-simple.pytmakeEditMenuFs
trelieftborderwidthitfills	menu demotpackerN(tTkinterRRRR tTktroottFrametRAISEDRRtXRRt
tk_menuBarttitleticonnametmainloop(((s5/usr/lib64/python2.7/Demo/tkinter/matt/menu-simple.pyt<module>s
#							

PK�
Q\�f� 44#matt/window-creation-w-location.pycnu�[����
��^c@sYddlTddlZdefd��YZdefd��YZe�Zej�dS(i����(t*Nt
QuitButtoncBseZd�ZRS(cOs\|jd�sd|d<n|jd�s;|j|d<nttj||f||�dS(NttexttQUITtcommand(thas_keytquittapplytButtont__init__(tselftmastertargstkwargs((sD/usr/lib64/python2.7/Demo/tkinter/matt/window-creation-w-location.pyR	s

(t__name__t
__module__R	(((sD/usr/lib64/python2.7/Demo/tkinter/matt/window-creation-w-location.pyR
stTestcBs&eZd�Zd�Zdd�ZRS(cGsgt�}t|dddd�|_|jjdddd�|jjdddd�|jj�dS(Ntwidtht2itheightt0(tTopleveltCanvastlabeltcreate_linetpack(R
Rtfred((sD/usr/lib64/python2.7/Demo/tkinter/matt/window-creation-w-location.pyt
makeWindows
	c
Csit|�|_|jjdtdt�t|ddddddd	|j�|_|jjdt�dS(
NtsidetfillRsMake a New WindowRi2RiR(RRRtLEFTtBOTHRR(R
((sD/usr/lib64/python2.7/Demo/tkinter/matt/window-creation-w-location.pyt
createWidgetsscCs+tj||�tj|�|j�dS(N(tFrameR	tPacktconfigR (R
R((sD/usr/lib64/python2.7/Demo/tkinter/matt/window-creation-w-location.pyR	's
N(RRRR tNoneR	(((sD/usr/lib64/python2.7/Demo/tkinter/matt/window-creation-w-location.pyRs			(tTkintertsysRRR!Rttesttmainloop(((sD/usr/lib64/python2.7/Demo/tkinter/matt/window-creation-w-location.pyt<module>s

	PK�
Q\e��̍�matt/canvas-demo-simple.pyonu�[����
��^c@s7ddlTdefd��YZe�Zej�dS(i����(t*tTestcBs&eZd�Zd�Zdd�ZRS(cCs	dGHdS(Nthi((tself((s</usr/lib64/python2.7/Demo/tkinter/matt/canvas-demo-simple.pytprintitscCs�t|ddddd|j�|_|jjdtdt�t|dd	d
d	�|_|jjdddddd
�|jjdt	�dS(NttexttQUITt
foregroundtredtcommandtsidetfilltwidtht5itheightit3itblack(
tButtontquitRtpacktBOTTOMtBOTHtCanvastdrawtcreate_rectangletLEFT(R((s</usr/lib64/python2.7/Demo/tkinter/matt/canvas-demo-simple.pyt
createWidgets	scCs+tj||�tj|�|j�dS(N(tFramet__init__tPacktconfigR(Rtmaster((s</usr/lib64/python2.7/Demo/tkinter/matt/canvas-demo-simple.pyRs
N(t__name__t
__module__RRtNoneR(((s</usr/lib64/python2.7/Demo/tkinter/matt/canvas-demo-simple.pyRs		N(tTkinterRRttesttmainloop(((s</usr/lib64/python2.7/Demo/tkinter/matt/canvas-demo-simple.pyt<module>s
	PK�
Q\b*�//matt/window-creation-simple.pynu�[���from Tkinter import *

# this shows how to spawn off new windows at a button press

class Test(Frame):
    def printit(self):
        print "hi"

    def makeWindow(self):
        fred = Toplevel()
        fred.label = Label(fred, text="Here's a new window")
        fred.label.pack()

    def createWidgets(self):
        self.QUIT = Button(self, text='QUIT', foreground='red',
                           command=self.quit)

        self.QUIT.pack(side=LEFT, fill=BOTH)

        # a hello button
        self.hi_there = Button(self, text='Make a New Window',
                               command=self.makeWindow)
        self.hi_there.pack(side=LEFT)

    def __init__(self, master=None):
        Frame.__init__(self, master)
        Pack.config(self)
        self.createWidgets()

test = Test()
test.mainloop()
PK�
Q\L�

!matt/printing-coords-of-items.pyonu�[����
��^c@s7ddlTdefd��YZe�Zej�dS(i����(t*tTestcBsAeZd�Zd�Zd�Zd�Zd�Zdd�ZRS(cCs�|jjt�s�|jj|jd|jd|jd|jddd�}|jj|d|j�|jj|d|j	�n|j|_
|j|_dS(Ni
tfilltgreens<Enter>s<Leave>(twidgettfind_withtagtCURRENTtdrawtcreate_ovaltxtyttag_bindt
mouseEntert
mouseLeavetlastxtlasty(tselfteventtfred((sB/usr/lib64/python2.7/Demo/tkinter/matt/printing-coords-of-items.pyt	mouseDown	s	+	cCsF|jjt|j|j|j|j�|j|_|j|_dS(N(RtmoveRR	RR
R(RR((sB/usr/lib64/python2.7/Demo/tkinter/matt/printing-coords-of-items.pyt	mouseMoves*cCs+|jjtdd�|jjt�GHdS(NRtred(Rt
itemconfigRtcoords(RR((sB/usr/lib64/python2.7/Demo/tkinter/matt/printing-coords-of-items.pyR"scCs|jjtdd�dS(NRtblue(RRR(RR((sB/usr/lib64/python2.7/Demo/tkinter/matt/printing-coords-of-items.pyR
(scCs�t|ddddd|j�|_|jjdtdt�t|dd	d
d	�|_|jjdt�tj	|jd|j
�tj	|jd|j�dS(
NttexttQUITt
foregroundRtcommandtsideRtwidtht5itheights<1>s<B1-Motion>(tButtontquitRtpacktLEFTtBOTHtCanvasRtWidgettbindRR(R((sB/usr/lib64/python2.7/Demo/tkinter/matt/printing-coords-of-items.pyt
createWidgets-scCs+tj||�tj|�|j�dS(N(tFramet__init__tPacktconfigR*(Rtmaster((sB/usr/lib64/python2.7/Demo/tkinter/matt/printing-coords-of-items.pyR,7s
N(	t__name__t
__module__RRRR
R*tNoneR,(((sB/usr/lib64/python2.7/Demo/tkinter/matt/printing-coords-of-items.pyRs					
N(tTkinterR+Rttesttmainloop(((sB/usr/lib64/python2.7/Demo/tkinter/matt/printing-coords-of-items.pyt<module>s
7	PK�
Q\��>;��matt/packer-simple.pyonu�[����
��^c@s7ddlTdefd��YZe�Zej�dS(i����(t*tTestcBs&eZd�Zd�Zdd�ZRS(cCs|jdGHdS(Ntcommand(thi_there(tself((s7/usr/lib64/python2.7/Demo/tkinter/matt/packer-simple.pytprintitscCs�t|ddddd|j�|_|jjdtdt�t|ddd|j�|_|jjdt�t|dd	�|_|jj�t|dd
�|_	|j	j�dS(NttexttQUITt
foregroundtredRtsidetfilltHellosbutton 2sbutton 3(
tButtontquitRtpacktLEFTtBOTHRRtguy2tguy3(R((s7/usr/lib64/python2.7/Demo/tkinter/matt/packer-simple.pyt
createWidgetss
cCs+tj||�tj|�|j�dS(N(tFramet__init__tPacktconfigR(Rtmaster((s7/usr/lib64/python2.7/Demo/tkinter/matt/packer-simple.pyRs
N(t__name__t
__module__RRtNoneR(((s7/usr/lib64/python2.7/Demo/tkinter/matt/packer-simple.pyRs		N(tTkinterRRttesttmainloop(((s7/usr/lib64/python2.7/Demo/tkinter/matt/packer-simple.pyt<module>s
	PK�
Q\�̆^#matt/not-what-you-might-think-1.pyonu�[����
��^c@sWddlTdefd��YZe�Zejjd�ejjd�ej�dS(i����(t*tTestcBseZd�Zdd�ZRS(cCsxt|dddddd�|_|jjdt�t|jddd	d
d|j�|j_|jjjdt�dS(Ntwidtht1itheightt
backgroundtgreentsidettexttQUITt
foregroundtredtcommand(tFrametGpaneltpacktLEFTtButtontquitR	(tself((sD/usr/lib64/python2.7/Demo/tkinter/matt/not-what-you-might-think-1.pyt
createWidgetsscCs+tj||�tj|�|j�dS(N(R
t__init__tPacktconfigR(Rtmaster((sD/usr/lib64/python2.7/Demo/tkinter/matt/not-what-you-might-think-1.pyRs
N(t__name__t
__module__RtNoneR(((sD/usr/lib64/python2.7/Demo/tkinter/matt/not-what-you-might-think-1.pyRs	
spacker demotpackerN(tTkinterR
RttestRttitleticonnametmainloop(((sD/usr/lib64/python2.7/Demo/tkinter/matt/not-what-you-might-think-1.pyt<module>s

	PK�
Q\o���VVmatt/rubber-band-box-demo-1.pynu�[���from Tkinter import *

class Test(Frame):
    def printit(self):
        print "hi"

    def createWidgets(self):
        self.QUIT = Button(self, text='QUIT',
                                  background='red',
                                  foreground='white',
                                  height=3,
                                  command=self.quit)
        self.QUIT.pack(side=BOTTOM, fill=BOTH)

        self.canvasObject = Canvas(self, width="5i", height="5i")
        self.canvasObject.pack(side=LEFT)

    def mouseDown(self, event):
        # canvas x and y take the screen coords from the event and translate
        # them into the coordinate system of the canvas object
        self.startx = self.canvasObject.canvasx(event.x)
        self.starty = self.canvasObject.canvasy(event.y)

    def mouseMotion(self, event):
        # canvas x and y take the screen coords from the event and translate
        # them into the coordinate system of the canvas object
        x = self.canvasObject.canvasx(event.x)
        y = self.canvasObject.canvasy(event.y)

        if (self.startx != event.x)  and (self.starty != event.y) :
            self.canvasObject.delete(self.rubberbandBox)
            self.rubberbandBox = self.canvasObject.create_rectangle(
                self.startx, self.starty, x, y)
            # this flushes the output, making sure that
            # the rectangle makes it to the screen
            # before the next event is handled
            self.update_idletasks()

    def mouseUp(self, event):
        self.canvasObject.delete(self.rubberbandBox)

    def __init__(self, master=None):
        Frame.__init__(self, master)
        Pack.config(self)
        self.createWidgets()

        # this is a "tagOrId" for the rectangle we draw on the canvas
        self.rubberbandBox = None

        # and the bindings that make it work..
        Widget.bind(self.canvasObject, "<Button-1>", self.mouseDown)
        Widget.bind(self.canvasObject, "<Button1-Motion>", self.mouseMotion)
        Widget.bind(self.canvasObject, "<Button1-ButtonRelease>", self.mouseUp)


test = Test()

test.mainloop()
PK�
Q\��ZZ��matt/window-creation-more.pyonu�[����
��^c@s7ddlTdefd��YZe�Zej�dS(i����(t*tTestcBs/eZd�Zd�Zd�Zdd�ZRS(cCs	dGHdS(Nthi((tself((s>/usr/lib64/python2.7/Demo/tkinter/matt/window-creation-more.pytprintitscCsOt�}t|dd|jd|j�|_|jj�|jd|_dS(NttextsThis is window number %d.tcommandi(tTopleveltButtont	windownumt
makeWindowtlabeltpack(Rtfred((s>/usr/lib64/python2.7/Demo/tkinter/matt/window-creation-more.pyR

s		

cCsrt|ddddd|j�|_|jjdtdt�t|ddd|j�|_|jjdt�dS(	NRtQUITt
foregroundtredRtsidetfillsMake a New Window(RtquitRRtLEFTtBOTHR
thi_there(R((s>/usr/lib64/python2.7/Demo/tkinter/matt/window-creation-more.pyt
createWidgetsscCs4tj||�tj|�d|_|j�dS(Ni(tFramet__init__tPacktconfigR	R(Rtmaster((s>/usr/lib64/python2.7/Demo/tkinter/matt/window-creation-more.pyRs
	N(t__name__t
__module__RR
RtNoneR(((s>/usr/lib64/python2.7/Demo/tkinter/matt/window-creation-more.pyRs			
N(tTkinterRRttesttmainloop(((s>/usr/lib64/python2.7/Demo/tkinter/matt/window-creation-more.pyt<module>s
	PK�
Q\�_ ��matt/canvas-demo-simple.pynu�[���from Tkinter import *

# this program creates a canvas and puts a single polygon on the canvas

class Test(Frame):
    def printit(self):
        print "hi"

    def createWidgets(self):
        self.QUIT = Button(self, text='QUIT', foreground='red',
                           command=self.quit)
        self.QUIT.pack(side=BOTTOM, fill=BOTH)

        self.draw = Canvas(self, width="5i", height="5i")

        # see the other demos for other ways of specifying coords for a polygon
        self.draw.create_rectangle(0, 0, "3i", "3i", fill="black")

        self.draw.pack(side=LEFT)

    def __init__(self, master=None):
        Frame.__init__(self, master)
        Pack.config(self)
        self.createWidgets()

test = Test()

test.mainloop()
PK�
Q\	����matt/slider-demo-1.pyonu�[����
��^c@s7ddlTdefd��YZe�Zej�dS(i����(t*tTestcBs/eZd�Zd�Zd�Zdd�ZRS(cCs
dG|GHdS(Ns
slider now at((tselftval((s7/usr/lib64/python2.7/Demo/tkinter/matt/slider-demo-1.pytprint_valuescCs|jjd�dS(Ni(tslidertset(R((s7/usr/lib64/python2.7/Demo/tkinter/matt/slider-demo-1.pytreset
scCs�t|dddddtdddd	d
|j�|_t|ddd
|j�|_t|dd
ddd
|j�|_|jjdt	�|jjdt	�|jjdt	dt
�dS(Ntfrom_ittoidtorienttlengtht3itlabelshappy slidertcommandttextsreset slidertQUITt
foregroundtredtsidetfill(tScalet
HORIZONTALRRtButtonRtquitRtpacktLEFTtBOTH(R((s7/usr/lib64/python2.7/Demo/tkinter/matt/slider-demo-1.pyt
createWidgets
scCs+tj||�tj|�|j�dS(N(tFramet__init__tPacktconfigR(Rtmaster((s7/usr/lib64/python2.7/Demo/tkinter/matt/slider-demo-1.pyRs
N(t__name__t
__module__RRRtNoneR(((s7/usr/lib64/python2.7/Demo/tkinter/matt/slider-demo-1.pyRs			N(tTkinterRRttesttmainloop(((s7/usr/lib64/python2.7/Demo/tkinter/matt/slider-demo-1.pyt<module>s
	PK�
Q\Ca�33matt/packer-simple.pynu�[���from Tkinter import *


class Test(Frame):
    def printit(self):
        print self.hi_there["command"]

    def createWidgets(self):
        # a hello button
        self.QUIT = Button(self, text='QUIT', foreground='red',
                           command=self.quit)
        self.QUIT.pack(side=LEFT, fill=BOTH)

        self.hi_there = Button(self, text='Hello',
                               command=self.printit)
        self.hi_there.pack(side=LEFT)

        # note how Packer defaults to side=TOP

        self.guy2 = Button(self, text='button 2')
        self.guy2.pack()

        self.guy3 = Button(self, text='button 3')
        self.guy3.pack()

    def __init__(self, master=None):
        Frame.__init__(self, master)
        Pack.config(self)
        self.createWidgets()

test = Test()
test.mainloop()
PK�
Q\�(�matt/canvas-mult-item-sel.pynu�[���from Tkinter import *

# allows moving dots with multiple selection.

SELECTED_COLOR = "red"
UNSELECTED_COLOR = "blue"

class Test(Frame):
    ###################################################################
    ###### Event callbacks for THE CANVAS (not the stuff drawn on it)
    ###################################################################
    def mouseDown(self, event):
        # see if we're inside a dot. If we are, it
        # gets tagged as CURRENT for free by tk.

        if not event.widget.find_withtag(CURRENT):
            # we clicked outside of all dots on the canvas. unselect all.

            # re-color everything back to an unselected color
            self.draw.itemconfig("selected", fill=UNSELECTED_COLOR)
            # unselect everything
            self.draw.dtag("selected")
        else:
            # mark as "selected" the thing the cursor is under
            self.draw.addtag("selected", "withtag", CURRENT)
            # color it as selected
            self.draw.itemconfig("selected", fill=SELECTED_COLOR)

        self.lastx = event.x
        self.lasty = event.y


    def mouseMove(self, event):
        self.draw.move("selected", event.x - self.lastx, event.y - self.lasty)
        self.lastx = event.x
        self.lasty = event.y

    def makeNewDot(self):
        # create a dot, and mark it as current
        fred = self.draw.create_oval(0, 0, 20, 20,
                                     fill=SELECTED_COLOR, tags=CURRENT)
        # and make it selected
        self.draw.addtag("selected", "withtag", CURRENT)

    def createWidgets(self):
        self.QUIT = Button(self, text='QUIT', foreground='red',
                           command=self.quit)

        ################
        # make the canvas and bind some behavior to it
        ################
        self.draw = Canvas(self, width="5i", height="5i")
        Widget.bind(self.draw, "<1>", self.mouseDown)
        Widget.bind(self.draw, "<B1-Motion>", self.mouseMove)

        # and other things.....
        self.button = Button(self, text="make a new dot", foreground="blue",
                             command=self.makeNewDot)

        message = ("%s dots are selected and can be dragged.\n"
                   "%s are not selected.\n"
                   "Click in a dot to select it.\n"
                   "Click on empty space to deselect all dots."
                   ) % (SELECTED_COLOR, UNSELECTED_COLOR)
        self.label = Message(self, width="5i", text=message)

        self.QUIT.pack(side=BOTTOM, fill=BOTH)
        self.label.pack(side=BOTTOM, fill=X, expand=1)
        self.button.pack(side=BOTTOM, fill=X)
        self.draw.pack(side=LEFT)

    def __init__(self, master=None):
        Frame.__init__(self, master)
        Pack.config(self)
        self.createWidgets()

test = Test()
test.mainloop()
PK�
Q\Qmatt/rubber-line-demo-1.pynu�[���from Tkinter import *

class Test(Frame):
    def printit(self):
        print "hi"

    def createWidgets(self):
        self.QUIT = Button(self, text='QUIT',
                                  background='red',
                                  foreground='white',
                                  height=3,
                                  command=self.quit)
        self.QUIT.pack(side=BOTTOM, fill=BOTH)

        self.canvasObject = Canvas(self, width="5i", height="5i")
        self.canvasObject.pack(side=LEFT)

    def mouseDown(self, event):
        # canvas x and y take the screen coords from the event and translate
        # them into the coordinate system of the canvas object
        self.startx = self.canvasObject.canvasx(event.x)
        self.starty = self.canvasObject.canvasy(event.y)

    def mouseMotion(self, event):
        # canvas x and y take the screen coords from the event and translate
        # them into the coordinate system of the canvas object
        x = self.canvasObject.canvasx(event.x)
        y = self.canvasObject.canvasy(event.y)

        if (self.startx != event.x)  and (self.starty != event.y) :
            self.canvasObject.delete(self.rubberbandLine)
            self.rubberbandLine = self.canvasObject.create_line(
                self.startx, self.starty, x, y)
            # this flushes the output, making sure that
            # the rectangle makes it to the screen
            # before the next event is handled
            self.update_idletasks()

    def __init__(self, master=None):
        Frame.__init__(self, master)
        Pack.config(self)
        self.createWidgets()
        # this is a "tagOrId" for the rectangle we draw on the canvas
        self.rubberbandLine = None
        Widget.bind(self.canvasObject, "<Button-1>", self.mouseDown)
        Widget.bind(self.canvasObject, "<Button1-Motion>", self.mouseMotion)


test = Test()

test.mainloop()
PK�
Q\Mh�Ω	�	matt/canvas-moving-w-mouse.pyonu�[����
��^c@s7ddlTdefd��YZe�Zej�dS(i����(t*tTestcBsAeZd�Zd�Zd�Zd�Zd�Zdd�ZRS(cCs|j|_|j|_dS(N(txtlastxtytlasty(tselftevent((s?/usr/lib64/python2.7/Demo/tkinter/matt/canvas-moving-w-mouse.pyt	mouseDown	scCsF|jjt|j|j|j|j�|j|_|j|_dS(N(tdrawtmovetCURRENTRRRR(RR((s?/usr/lib64/python2.7/Demo/tkinter/matt/canvas-moving-w-mouse.pyt	mouseMoves*cCs|jjtdd�dS(Ntfilltred(R	t
itemconfigR(RR((s?/usr/lib64/python2.7/Demo/tkinter/matt/canvas-moving-w-mouse.pyt
mouseEnterscCs|jjtdd�dS(NR
tblue(R	RR(RR((s?/usr/lib64/python2.7/Demo/tkinter/matt/canvas-moving-w-mouse.pyt
mouseLeavesc	Cs�t|ddddd|j�|_|jjdtdt�t|dd	d
d	�|_|jjdt�|jjdddddd
dd�}|jj	|d|j
�|jj	|d|j�tj
|jd|j�tj
|jd|j�dS(NttexttQUITt
foregroundRtcommandtsideR
twidtht5itheightiitgreenttagstselecteds<Any-Enter>s<Any-Leave>s<1>s<B1-Motion>(tButtontquitRtpacktLEFTtBOTHtCanvasR	tcreate_ovalttag_bindRRtWidgettbindRR(Rtfred((s?/usr/lib64/python2.7/Demo/tkinter/matt/canvas-moving-w-mouse.pyt
createWidgets!scCs+tj||�tj|�|j�dS(N(tFramet__init__tPacktconfigR)(Rtmaster((s?/usr/lib64/python2.7/Demo/tkinter/matt/canvas-moving-w-mouse.pyR+1s
N(	t__name__t
__module__RRRRR)tNoneR+(((s?/usr/lib64/python2.7/Demo/tkinter/matt/canvas-moving-w-mouse.pyRs						N(tTkinterR*Rttesttmainloop(((s?/usr/lib64/python2.7/Demo/tkinter/matt/canvas-moving-w-mouse.pyt<module>s
1	PK�
Q\�]���!matt/animation-w-velocity-ctrl.pynu�[���from Tkinter import *

# this is the same as simple-demo-1.py, but uses
# subclassing.
# note that there is no explicit call to start Tk.
# Tkinter is smart enough to start the system if it's not already going.


class Test(Frame):
    def printit(self):
        print "hi"

    def createWidgets(self):
        self.QUIT = Button(self, text='QUIT', foreground='red',
                           command=self.quit)
        self.QUIT.pack(side=BOTTOM, fill=BOTH)

        self.draw = Canvas(self, width="5i", height="5i")

        self.speed = Scale(self, orient=HORIZONTAL, from_=-100, to=100)

        self.speed.pack(side=BOTTOM, fill=X)

        # all of these work..
        self.draw.create_rectangle(0, 0, 10, 10, tags="thing", fill="blue")
        self.draw.pack(side=LEFT)

    def moveThing(self, *args):
        velocity = self.speed.get()
        str = float(velocity) / 1000.0
        str = "%ri" % (str,)
        self.draw.move("thing",  str, str)
        self.after(10, self.moveThing)

    def __init__(self, master=None):
        Frame.__init__(self, master)
        Pack.config(self)
        self.createWidgets()
        self.after(10, self.moveThing)


test = Test()

test.mainloop()
PK�
Q\
Cx�jjguido/paint.pynu�[���PK�
Q\��kK�\�\�guido/sortvisu.pycnu�[���PK�
Q\ե�))�dguido/hanoi.pynu�[���PK�
Q\Xj|0J|J|
wguido/ss1.pyonu�[���PK�
Q\M�dUU��guido/MimeViewer.pycnu�[���PK�
Q\k>'��,guido/hello.pycnu�[���PK�
Q\�X�\(
guido/ManPage.pyonu�[���PK�
Q\M�dUU�#guido/MimeViewer.pyonu�[���PK�
Q\27O�::7guido/imageview.pycnu�[���PK�
Q\a�A����9guido/newmenubardemo.pynuȯ��PK�
Q\v�����>guido/canvasevents.pynuȯ��PK�
Q\&Y����Xguido/listtree.pycnu�[���PK�
Q\-�ɖ55
�^guido/mbox.pynuȯ��PK�
Q\/	Ŕccp|guido/brownian2.pynu�[���PK�
Q\	�7E� � �guido/mbox.pyonu�[���PK�
Q\"��@@�guido/kill.pycnu�[���PK�
Q\�(�V����guido/ManPage.pynu�[���PK�
Q\^�������guido/wish.pycnu�[���PK�
Q\%L����guido/brownian2.pycnu�[���PK�
Q\E`}eR	R	��guido/electrons.pycnu�[���PK�
Q\���X�#�#z�guido/tkman.pyonu�[���PK�
Q\�h��:	guido/imagedraw.pyonu�[���PK�
Q\��LLguido/ShellWindow.pynu�[���PK�
Q\`�xII�guido/hanoi.pycnu�[���PK�
Q\~H�+��.guido/ShellWindow.pycnu�[���PK�
Q\n�`�		>Dguido/electrons.pynuȯ��PK�
Q\`�xII�Mguido/hanoi.pyonu�[���PK�
Q\D����]guido/optionmenu.pynu�[���PK�
Q\�#��_guido/imageview.pynu�[���PK�
Q\��GfGf%`guido/ss1.pynu�[���PK�
Q\�|�D����guido/paint.pycnu�[���PK�
Q\.��55��guido/svkill.pycnu�[���PK�
Q\���,�)�)�guido/canvasevents.pycnu�[���PK�
Q\-���88Aguido/AttrDialog.pynu�[���PK�
Q\�˗*KK�Iguido/hello.pynu�[���PK�
Q\qf�XXKguido/newmenubardemo.pycnu�[���PK�
Q\����YY�Qguido/brownian.pycnu�[���PK�
Q\%L��LXguido/brownian2.pyonu�[���PK�
Q\�Ṁ���_guido/dialog.pynuȯ��PK�
Q\KѴ�Q�QHlguido/solitaire.pyonu�[���PK�
Q\��sl�~�~
,�guido/ss1.pycnu�[���PK�
Q\)�Yz�K�K=guido/sortvisu.pynuȯ��PK�
Q\~H�+���guido/ShellWindow.pyonu�[���PK�
Q\���X�#�#
�guido/tkman.pycnu�[���PK�
Q\�h����guido/imagedraw.pycnu�[���PK�
Q\��I����guido/rmt.pynuȯ��PK�
Q\&Y���Z�guido/listtree.pyonu�[���PK�
Q\�^u�ii��guido/switch.pycnu�[���PK�
Q\�`&�CCB�guido/brownian.pynu�[���PK�
Q\KѴ�Q�Q��guido/solitaire.pycnu�[���PK�
Q\���oo�Aguido/dialog.pyonu�[���PK�
Q\�<J=YNguido/svkill.pynuȯ��PK�
Q\�^u�ii�aguido/switch.pyonu�[���PK�
Q\E`}eR	R	Amguido/electrons.pyonu�[���PK�
Q\��|
���vguido/MimeViewer.pynuȯ��PK�
Q\j'����guido/imagedraw.pynu�[���PK�
Q\��1�guido/switch.pynu�[���PK�
Q\.�V�oo
?�guido/wish.pynu�[���PK�
Q\&�S�}E}E�guido/solitaire.pynuȯ��PK�
Q\����YY��guido/brownian.pyonu�[���PK�
Q\�+�$RRE�guido/optionmenu.pyonu�[���PK�
Q\^�������guido/wish.pyonu�[���PK�
Q\27O�::��guido/imageview.pyonu�[���PK�
Q\	�7E� � w�guido/mbox.pycnu�[���PK�
Q\k>'��f	guido/hello.pyonu�[���PK�
Q\�X�\bguido/ManPage.pycnu�[���PK�
Q\"��@@�%guido/kill.pyonu�[���PK�
Q\��kK�\�\89guido/sortvisu.pyonu�[���PK�
Q\���oo5�guido/dialog.pycnu�[���PK�
Q\qf�XX�guido/newmenubardemo.pyonu�[���PK�
Q\.��,#,#��guido/tkman.pynuȯ��PK�
Q\���,�)�)��guido/canvasevents.pyonu�[���PK�
Q\.��55�guido/svkill.pyonu�[���PK�
Q\��V���
�guido/rmt.pycnu�[���PK�
Q\�+�$RRw"guido/optionmenu.pycnu�[���PK�
Q\�m.,,

%guido/kill.pynuȯ��PK�
Q\�|�D��v4guido/paint.pyonu�[���PK�
Q\��V���
x=guido/rmt.pyonu�[���PK�
Q\)t�MIMIjQguido/AttrDialog.pyonu�[���PK�
Q\E�7����guido/listtree.pynu�[���PK�
Q\)t�MIMI�guido/AttrDialog.pycnu�[���PK�
Q\�Ծ����READMEnu�[���PK�
Q\�j:�^^�ttk/plastik_theme.pyonu�[���PK�
Q\��qP�
�
"ttk/dirbrowser.pynu�[���PK�
Q\Rh�|@@ttk/listbox_scrollcmd.pyonu�[���PK�
Q\�-����ttk/listbox_scrollcmd.pynu�[���PK�
Q\#��ggVttk/treeview_multicolumn.pycnu�[���PK�
Q\��"�P
P
	4ttk/widget_state.pycnu�[���PK�
Q\Rh�|@@�Attk/listbox_scrollcmd.pycnu�[���PK�
Q\�O���&Httk/dirbrowser.pycnu�[���PK�
Q\w�%>>�Wttk/theme_selector.pyonu�[���PK�
Q\a�O���tcttk/theme_selector.pynu�[���PK�
Q\��"�P
P
lkttk/widget_state.pyonu�[���PK�
Q\xa��##yttk/roundframe.pyonu�[���PK�
Q\�^��e�ttk/treeview_multicolumn.pynu�[���PK�
Q\��[���F�ttk/mac_searchentry.pynu�[���PK�
Q\�J"_���ttk/notebook_closebtn.pyonu�[���PK�
Q\w�%>>��ttk/theme_selector.pycnu�[���PK�
Q\��$&$&�ttk/ttkcalendar.pyonu�[���PK�
Q\y5�L����ttk/roundframe.pynu�[���PK�
Q\�/
QQ	ttk/combo_themes.pynu�[���PK�
Q\#��gg�	ttk/treeview_multicolumn.pyonu�[���PK�
Q\|&C]��O"	ttk/combo_themes.pycnu�[���PK�
Q\|&C]��*	ttk/combo_themes.pyonu�[���PK�
Q\�J"_���1	ttk/notebook_closebtn.pycnu�[���PK�
Q\>����=	ttk/mac_searchentry.pyonu�[���PK�
Q\>����M	ttk/mac_searchentry.pycnu�[���PK�
Q\��yTt%t%n]	ttk/plastik_theme.pynu�[���PK�
Q\�xU�ee&�	ttk/img/close.gifnu�[���PK�
Q\�|!eẽ	ttk/img/close_pressed.gifnu�[���PK�
Q\�.�PPz�	ttk/img/close_active.gifnu�[���PK�
Q\a�kJ�
�
�	ttk/widget_state.pynu�[���PK�
Q\xa��##��	ttk/roundframe.pycnu�[���PK�
Q\n�nF�	�	[�	ttk/notebook_closebtn.pynu�[���PK�
Q\�O�����	ttk/dirbrowser.pyonu�[���PK�
Q\��$&$&L�	ttk/ttkcalendar.pycnu�[���PK�
Q\�8�~ ~ ��	ttk/ttkcalendar.pynu�[���PK�
Q\�j:�^^s

ttk/plastik_theme.pycnu�[���PK�
Q\���*hh#(
matt/entry-with-shared-variable.pyonu�[���PK�
Q\R��۩��.
matt/menu-simple.pyonu�[���PK�
Q\�D66�6
matt/placer-simple.pynu�[���PK�
Q\��>kv	v	!9;
matt/canvas-moving-or-creating.pynu�[���PK�
Q\�}N�

E
matt/pong-demo-1.pynu�[���PK�
Q\3��(jjPK
matt/window-creation-simple.pyonu�[���PK�
Q\k�����	R
matt/dialog-box.pyonu�[���PK�
Q\�}�`	`	 Z
matt/printing-coords-of-items.pynu�[���PK�
Q\��>;���c
matt/packer-simple.pycnu�[���PK�
Q\Mh�Ω	�	�i
matt/canvas-moving-w-mouse.pycnu�[���PK�
Q\�j�HH�s
matt/radiobutton-simple.pyonu�[���PK�
Q\4+���{
matt/two-radio-groups.pycnu�[���PK�
Q\0L����
matt/killing-window-w-wm.pycnu�[���PK�
Q\;mDD �
matt/canvas-reading-tag-info.pyonu�[���PK�
Q\;U<��"��
matt/subclass-existing-widgets.pyonu�[���PK�
Q\������Ȗ
matt/animation-simple.pyonu�[���PK�
Q\���*hh#ɝ
matt/entry-with-shared-variable.pycnu�[���PK�
Q\:���
�
��
matt/canvas-mult-item-sel.pycnu�[���PK�
Q\|=4�>>ǯ
matt/canvas-with-scrollbars.pynu�[���PK�
Q\������S�
matt/animation-simple.pycnu�[���PK�
Q\;U<��"T�
matt/subclass-existing-widgets.pycnu�[���PK�
Q\�̆^#x�
matt/not-what-you-might-think-1.pycnu�[���PK�
Q\��t44��
matt/entry-simple.pycnu�[���PK�
Q\#U����X�
matt/entry-simple.pynu�[���PK�
Q\e��̍�u�
matt/canvas-demo-simple.pycnu�[���PK�
Q\�F�77#M�
matt/not-what-you-might-think-2.pycnu�[���PK�
Q\�3�--"��
matt/window-creation-w-location.pynu�[���PK�
Q\:���
�
V�
matt/canvas-mult-item-sel.pyonu�[���PK�
Q\�F�77#��
matt/not-what-you-might-think-2.pyonu�[���PK�
Q\ʥ�E��"#�
matt/not-what-you-might-think-1.pynu�[���PK�
Q\�Q.��
matt/killing-window-w-wm.pynu�[���PK�
Q\	����r�
matt/slider-demo-1.pycnu�[���PK�
Q\���d�� hmatt/canvas-w-widget-draw-el.pyonu�[���PK�
Q\�;����matt/window-creation-more.pynu�[���PK�
Q\L�

!�matt/printing-coords-of-items.pycnu�[���PK�
Q\4+���Hmatt/two-radio-groups.pyonu�[���PK�
Q\0L���! matt/killing-window-w-wm.pyonu�[���PK�
Q\�j�HHB&matt/radiobutton-simple.pycnu�[���PK�
Q\k������-matt/dialog-box.pycnu�[���PK�
Q\��Vkk"�5matt/menu-all-types-of-entries.pyonu�[���PK�
Q\a>oQ��"�Imatt/animation-w-velocity-ctrl.pyonu�[���PK�
Q\�nЈ	�	�Qmatt/dialog-box.pynu�[���PK�
Q\~�����[matt/00-HELLO-WORLD.pynu�[���PK�
Q\b�r;	;	�^matt/canvas-with-scrollbars.pycnu�[���PK�
Q\����:hmatt/rubber-line-demo-1.pycnu�[���PK�
Q\~ǁ���"fqmatt/not-what-you-might-think-2.pynu�[���PK�
Q\a>oQ��"�tmatt/animation-w-velocity-ctrl.pycnu�[���PK�
Q\���ll#�|matt/packer-and-placer-together.pycnu�[���PK�
Q\���d�� ��matt/canvas-w-widget-draw-el.pycnu�[���PK�
Q\;mDD Јmatt/canvas-reading-tag-info.pycnu�[���PK�
Q\�Fֳ�d�matt/menu-simple.pynu�[���PK�
Q\��ZZ��Z�matt/window-creation-more.pycnu�[���PK�
Q\��t44^�matt/entry-simple.pyonu�[���PK�
Q\�uk/��רmatt/animation-simple.pynu�[���PK�
Q\�w�� ʬmatt/bind-w-mult-calls-p-type.pynu�[���PK�
Q\�� �yy!(�matt/bind-w-mult-calls-p-type.pycnu�[���PK�
Q\�����matt/rubber-line-demo-1.pyonu�[���PK�
Q\�x�#�#!�matt/menu-all-types-of-entries.pynu�[���PK�
Q\�!���matt/READMEnu�[���PK�
Q\b�r;	;	A�matt/canvas-with-scrollbars.pyonu�[���PK�
Q\��Vkk"��matt/menu-all-types-of-entries.pycnu�[���PK�
Q\���ll#�matt/packer-and-placer-together.pyonu�[���PK�
Q\`MY��!Gmatt/subclass-existing-widgets.pynu�[���PK�
Q\��g=matt/00-HELLO-WORLD.pyonu�[���PK�
Q\v��	
	
�matt/rubber-band-box-demo-1.pycnu�[���PK�
Q\�>����matt/two-radio-groups.pynu�[���PK�
Q\�	��NN�,matt/canvas-moving-w-mouse.pynu�[���PK�
Q\�� �yy!�5matt/bind-w-mult-calls-p-type.pyonu�[���PK�
Q\3��(jjJ;matt/window-creation-simple.pycnu�[���PK�
Q\�J����Bmatt/radiobutton-simple.pynu�[���PK�
Q\��)��(Jmatt/canvas-reading-tag-info.pynu�[���PK�
Q\�		Qmatt/canvas-gridding.pyonu�[���PK�
Q\��g`Zmatt/00-HELLO-WORLD.pycnu�[���PK�
Q\����PP�_matt/pong-demo-1.pycnu�[���PK�
Q\�		Nhmatt/canvas-gridding.pycnu�[���PK�
Q\���'���qmatt/canvas-gridding.pynu�[���PK�
Q\�f� 44#�zmatt/window-creation-w-location.pyonu�[���PK�
Q\v��	
	
V�matt/rubber-band-box-demo-1.pyonu�[���PK�
Q\S�"

��matt/placer-simple.pyonu�[���PK�
Q\��aI

"�matt/canvas-moving-or-creating.pyonu�[���PK�
Q\#~���"j�matt/entry-with-shared-variable.pynu�[���PK�
Q\�X
���"��matt/packer-and-placer-together.pynu�[���PK�
Q\�P6����matt/slider-demo-1.pynu�[���PK�
Q\����PPǭmatt/pong-demo-1.pyonu�[���PK�
Q\����[�matt/canvas-w-widget-draw-el.pynu�[���PK�
Q\S�"

D�matt/placer-simple.pycnu�[���PK�
Q\��aI

"��matt/canvas-moving-or-creating.pycnu�[���PK�
Q\R��۩��matt/menu-simple.pycnu�[���PK�
Q\�f� 44#��matt/window-creation-w-location.pycnu�[���PK�
Q\e��̍�t�matt/canvas-demo-simple.pyonu�[���PK�
Q\b*�//L�matt/window-creation-simple.pynu�[���PK�
Q\L�

!��matt/printing-coords-of-items.pyonu�[���PK�
Q\��>;��0�matt/packer-simple.pyonu�[���PK�
Q\�̆^#�matt/not-what-you-might-think-1.pyonu�[���PK�
Q\o���VVm�matt/rubber-band-box-demo-1.pynu�[���PK�
Q\��ZZ��
matt/window-creation-more.pyonu�[���PK�
Q\�_ ��

matt/canvas-demo-simple.pynu�[���PK�
Q\	����K

matt/slider-demo-1.pyonu�[���PK�
Q\Ca�33A
matt/packer-simple.pynu�[���PK�
Q\�(��
matt/canvas-mult-item-sel.pynu�[���PK�
Q\Q#
matt/rubber-line-demo-1.pynu�[���PK�
Q\Mh�Ω	�	�*
matt/canvas-moving-w-mouse.pyonu�[���PK�
Q\�]���!�4
matt/animation-w-velocity-ctrl.pynu�[���PK��K�9