B
     Q                 @   s6   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Zdd ZdS )
Balleu$   Balle se déplaçant dans un canevas
   redc             C   sh   || _ || _|j| _d| _d| _d\| _| _d| _| jj| j| | j| | j| | j| ddd| _	d S )N   )   r         r   )widthfill)
rayonmastercanxydxdyvcreate_ovalid)selfr   r   Zcouleur r   e/Users/jerome/SynologyDrive/College/Informatique/OCI/1_Site/1_Programmation/8_GUI/Exercices/ex8_16.py__init__
   s    zBalle.__init__c             C   s   | j | j }}| j dkr(| j | _d| _ | j dk rB| j | _d| _ | j| j | _| j| j | _| jdkrzd| _| j | _n| j | j | _ | j| j| j | j | j| j | j | j | j| j  | jj	||| j | jdd | j
jdkr| j
d| j d	S )
u}   
        Déplacement de la balle attirée par la force de pesanteur
        et rebonds contre les parois du canevas
        i  r   r      z
light grey)r   r   2   N)r   r   r   r   r   r   coordsr   r   create_liner   flagaftermove)r   ZxpZypr   r   r   r    !   s$    




z
Balle.moveN)r   r   )__name__
__module____qualname____doc__r   r    r   r   r   r   r      s   
r   c               @   s$   e Zd Zdd Zdd Zdd ZdS )Applicationc             C   s   t |  | d t| dddd| _| j  t| | _d| _t	| d| j
djtd	d
 t	| d| jdjtd t	| d| jdjtd	d
 d S )NzChute et rebondswhite   i  )bgheightr
   r   ZStart)textcommandr   )sidepadxZStop)r,   Quitter)Tkr   titleCanvasr   packr   baller   ButtonstartLEFTstopdestroyRIGHT)r   r   r   r   r   J   s    



zApplication.__init__c             C   s   | j dkrd| _ | j  dS )u   Démarrage de l'animationr      N)r   r3   r    )r   r   r   r   r5   ^   s    
zApplication.startc             C   s
   d| _ dS )u   Arrêt de l'animationr   N)r   )r   r   r   r   r7   d   s    zApplication.stopN)r!   r"   r#   r   r5   r7   r   r   r   r   r%   H   s   r%   N)tkinterobjectr   r/   r%   mainloopr   r   r   r   <module>   s   A#