B
    X,Y                 @   s>   d dl T d dlT G dd deZG dd deZe   dS )    )*c               @   s.   e Zd ZdZddddgZdddZd	d
 ZdS )Balleu$   Balle se déplaçant dans un canevasredyellowZgreenZblue   c             C   s   || _ d| _|| _|j| _t| j d d | _t| j d | _d| _	| jj
| j| | j| | j| | j| dtj| j	 d| _d S )Ng?   x   r   )widthfill)rayonangmastercanintwinfo_reqwidthxwinfo_reqheightyicreate_ovalr   coulid)selfr   r   Zcouleur r   e/Users/jerome/SynologyDrive/College/Informatique/OCI/1_Site/1_Programmation/8_GUI/Exercices/ex8_14.py__init__   s    &zBalle.__init__c             C   s0  | j | j }}t| jt| j }}|d t| j d  | _ |d t| j d  | _| j	| j
| j | j | j| j | j | j | j| j  | jj||| j | jddd |  jd7  _| jdt kr|  jdt 8  _| jd ttj | _| jj| j
tj| j d | jjdkr,| jd	| j d
S )uk   
        Déplace autour d'un cercle imaginaire de rayon 120,
        centré au milieu du canevas
        r   r   black)r	   r
   g?   )r
   r   2   N)r   r   cosr   sinr   r   r   r   coordsr   r   create_linepir   lenr   r   itemconfigurer   flagafteravance)r   ZxpZypr   r   r   r   r   r(   !   s    zBalle.avanceN)r   r   )__name__
__module____qualname____doc__r   r   r(   r   r   r   r   r      s   
r   c               @   s&   e Zd Zd	ddZdd Zdd ZdS )
Application,  c             C   s   t |  | d t| d||d| _| jjddd t| | _d| _t	| d| j
d	jd
dddd t	| d| jd	jd
d
ddd t	| d| jd	jd
dddd d S )NzExercice 8.14z	dark grey)bgheightr	   r      )rowZ
columnspanr   Quitter)textcommandr   
      )r2   columnpadxpadyu	   Démarreru   Arrêter   )Tkr   titleCanvasr   gridr   baller&   Buttondestroystart_itstop_it)r   hwr   r   r   r   E   s    


zApplication.__init__c             C   s   | j dkrd| _ | j  dS )u   Démarrage de l'animationr   r   N)r&   r@   r(   )r   r   r   r   rC   Z   s    
zApplication.start_itc             C   s
   d| _ dS )u   Arrêt de l'animationr   N)r&   )r   r   r   r   rD   `   s    zApplication.stop_itN)r.   r.   )r)   r*   r+   r   rC   rD   r   r   r   r   r-   C   s   
r-   N)tkintermathobjectr   r<   r-   mainloopr   r   r   r   <module>   s   ;$