|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
1200+ fellow developers rate and compare features of the top IDEs, like Visual Studio, Eclipse, RAD, Delphi and others, across 13 categories. Enjoy this FREE Download of the IDE User Satisfaction Study by Evans Data Corporation. Download Now!
|
|
#1
|
|||
|
|||
|
SoS on Tkinter (psychological test)
Hello everyone,
First, sorry for my poor english (i am french..) I try to develop an program with Tkinter. This program is a attentional psychological test witch is used for evaluate attention in schizophrenic patients. Methodology: 3 references images are in top-center of window in middle of windows, a series of 30 images (3 row of 10 images). If image on the bottom is identical at the references images, the patient must click on the mouse. I have make all interface code, but I need help for obtain the results of this task If its possible, I want know the number of good responses (when a patient click on good image (same at reference image)) and the number of wrong responses(when patient has click on image who has different of reference image). I want to know too, the number of bottom which has been analysed by the patient in 30 sec. I am a newbie in python development, and i think with your help I will finish this program. Summary Python code: root = Tk() root.title("jeu de carte") larg, haut=root.winfo_screenwidth(), root.winfo_screenheight() root.overrideredirect(1) root.geometry("%dx%d+0+0" % (larg, haut)) frame1= Frame(root) frame2= Frame(root) frame1.grid(row=0, column=0) frame2.grid(row=1, column=0) #card list liste_cartes = ['c:/carte1.gif', 'c:/carte2.gif', 'c:/carte3.gif', 'c:/carte4.gif', 'c:/carte5.gif', 'c:/carte6.gif', 'c:/carte7.gif', 'c:/carte8.gif', 'c:/carte9.gif', 'c:/carte10.gif'] #tirage aléatoire de l'image de la carte modèle temp= liste_cartes carte_modèle= random.choice(temp) #affichage de l'image de la carte modèle dans le frame1 carte_modèle = PhotoImage (file=carte_modèle) label1= Label(frame1, image=carte_modèle, borderwidth=5, relief=RIDGE) label1.grid() #Choix aléatoire des images de carte sur les boutons en frame 2 class ImButton(Button): def __init__(self,master,liste,**args): f=random.choice(liste) self.p=PhotoImage(file=f) #Création des Boutons r=2 while r >= 0: c=8 while c>=0: b=ImButton(frame2,liste_cartes) b.grid(row=r, column=c, padx= 3, pady= 3, ipadx=5, ipady= 5 r= r-1 root.mainloop() __________________________________________________________________________ Thkx a lot for you r help |
|
#2
|
||||
|
||||
|
Well I don't have much time to look on that, but I did translate the comments for our non-french speaking friends. just in case they're faster than me (and they are
):Code:
root = Tk()
root.title("jeu de carte")
larg, haut=root.winfo_screenwidth(), root.winfo_screenheight()
root.overrideredirect(1)
root.geometry("%dx%d+0+0" % (larg, haut))
frame1= Frame(root)
frame2= Frame(root)
frame1.grid(row=0, column=0)
frame2.grid(row=1, column=0)
#card list
liste_cartes = ['c:/carte1.gif',
'c:/carte2.gif',
'c:/carte3.gif',
'c:/carte4.gif',
'c:/carte5.gif',
'c:/carte6.gif',
'c:/carte7.gif',
'c:/carte8.gif',
'c:/carte9.gif',
'c:/carte10.gif']
#random drawing of the card model's image
temp= liste_cartes
carte_modèle= random.choice(temp)
#display of image card model in frame1
carte_modèle = PhotoImage (file=carte_modèle)
label1= Label(frame1, image=carte_modèle, borderwidth=5, relief=RIDGE)
label1.grid()
#Random choice of card images for buttons on frame 2
class ImButton(Button):
def __init__(self,master,liste,**args):
f=random.choice(liste)
self.p=PhotoImage(file=f)
#Button creation
r=2
while r >= 0:
c=8
while c>=0:
b=ImButton(frame2,liste_cartes)
b.grid(row=r, column=c, padx= 3, pady= 3, ipadx=5, ipady= 5
r= r-1
root.mainloop()
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Python Programming > SoS on Tkinter (psychological test) |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|