Bonjour,

Déjà merci à ceux qui vont me répondre. Voici mon problème : il y a quelques jours j'étaient sous Ubuntu où j’utilisai Python 2.7.X mon programme fonctionnait très bien. Depuis hier je suis retourné sur Windows (10) et depuis mon programme s'affichent en HD et plus en Full HD donc ma fenêtre ne s'affiche plus correctement ( j'utilise Tkinter et ai bien mis les dimension en 1920x1080 ) bien que je soit toujours sur un écran Full HD. Quelqu'un aurait-il la solution? Merci.

[Edit :] Je suis bien en 2.7.11 sur windows

Voici mon code au cas où :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
# -*- coding: cp1252 -*-
 
import time
import Tkinter
from Tkinter import *
import random
 
#------------------------------------------------------------------------------#
#------------------------------- Projet ISN -----------------------------------#
#------------------------------------------------------------------------------#
 
def Initialisation():
 
 
    global fen,img1,img2,r,s,n,z,xx1,xx2,yy2,yy1,img3,img4,p,img5,sc,u
 
    print " Entrée dans Initialisation. "
    print ""
 
    n=25
    r=0
    s=0
    z=0
    p=0
    u=0
    sc=0
 
    fen=Tk()
    fen.title("Doge Walk / Menu")
    fen.attributes('-fullscreen', 1)
 
    img1=PhotoImage(file="Menu.gif")
    img2=PhotoImage(file="Jeu.gif")
    img3=PhotoImage(file="Menu2.gif")
    img4=PhotoImage(file="DOGE RUN.gif")
    img5=PhotoImage(file="Sortie.gif")
 
    print " Sortie de Initialisation. "
    print ""
 
#------------------------------------------------------------------------------#
#---------------------------------- Menu --------------------------------------#
#------------------------------------------------------------------------------#
 
def Menu():
 
    global fen,img1
 
    print " Entrée dans le menu. "
    print ""
 
    Canvas_Menu = Canvas(fen, width=1920, height=1080, background='darkgray')
    Canvas_Menu.pack()
 
    Image_Du_Menu2 = Canvas_Menu.create_image(960, 540, image=img3)
 
    Image_Du_Menu = Canvas_Menu.create_image(960, 540, image=img1)
 
    Image_Du_Menu3 = Canvas_Menu.create_image(1700, 450, image=img4)
 
    Canvas_Menu.bind('<Button-1>', boutton)
 
    fen.update()
    fen.mainloop()
 
def boutton(event):
 
    X = event.x
    Y = event.y
 
    print(X, Y)
    print ""
 
    if 1170<X<1670 and 750<Y<1000:
            Credits() #Crédits
 
    if 700<X<1220 and 400<Y<650:
            PreJeu() #Jouer
 
    if 250<X<750 and 750<Y<1000:
            Options() #Options
 
    if 1550<X<1850 and 200<Y<700:
            Quitter() #Quitte le Programme
 
 
def Quitter():
 
    fen.quit()
    fen.destroy()
    fen.mainloop()
    quit()
 
#------------------------------------------------------------------------------#
#----------------------------------- Jeu --------------------------------------#
#------------------------------------------------------------------------------#
 
def PreJeu():
    global fen,fen3,fen2,Canvas_Jeu,img2,n,img4
 
    fen.quit()
 
    print " Sortie du menu. "
    print ""
 
    fen2=Toplevel()
    fen2.title("Doge Walk / Jeu")
    fen2.attributes('-fullscreen', 1)
 
    Canvas_Jeu = Canvas(fen2, width=1920, height=1080, background='darkgray')
    Canvas_Jeu.pack()
 
    print " Entrée dans les préparations au Jeu "
    print ""
 
    Image_Du_Jeu = Canvas_Jeu.create_image(960, 540, image=img2)
    Image_Du_Jeu2 = Canvas_Jeu.create_image(1850, 30, image=img5)
 
    fen2.update()
 
    fen3=Toplevel()
    fen3.title("Doge Walk / Comment Jouer")
 
    Canvas_Jeu2 = Canvas(fen3, width=500, height=300)
    Canvas_Jeu2.grid(column=3,row=1)
 
    texte0 = Label(fen3, text= " ")
    texte0.grid(column=1,row=2)
 
 
    btn3 = Button(fen3, text="Courte",command=Courte)
    btn3.grid(column=2,row=2)
 
    btn2 = Button(fen3, text="Moyenne",command=Moyenne)
    btn2.grid(column=3,row=2)
 
    btn1 = Button(fen3, text="Longue",command=Longue)
    btn1.grid(column=4,row=2)
 
    message1 = Canvas_Jeu2.create_text(250,40,text="Comment Jouer ?!", font ="Trebuchet 25 italic", fill="dark red" )
    message2 = Canvas_Jeu2.create_text(250,80,text="Il vous suffit de cliquer pour sauter", font ="Trebuchet 12", fill="black" )
    message3 = Canvas_Jeu2.create_text(250,100,text="et ainsi de finir le plus vite possible.", font ="Trebuchet 12", fill="black" )
    message4 = Canvas_Jeu2.create_text(250,280,text="Choix de la longueur de la course :", font ="Trebuchet 12", fill="black" )
    message5 = Canvas_Jeu2.create_text(250,120,text="Mais attention à sauter au bon moment !", font ="Trebuchet 12", fill="black" )
    message6 = Canvas_Jeu2.create_text(250,140,text="Bon Jeu !! :)", font ="Trebuchet 12", fill="black" )
 
    Canvas_Jeu3 = Canvas(fen3, width=500, height=100)
    Canvas_Jeu3.grid(column=3,row=3)
 
    message16 = Canvas_Jeu3.create_text(250,50,text="Choix de la difficulte :", font ="Trebuchet 12", fill="black" )
 
    btn7 = Button(fen3, text="Facile",command=Facile)
    btn7.grid(column=2,row=4)
 
    btn8 = Button(fen3, text="Moyen",command=Moyen)
    btn8.grid(column=3,row=4)
 
    btn9 = Button(fen3, text="Difficile",command=Difficile)
    btn9.grid(column=4,row=4) 
 
    Canvas_Jeu.bind('<Button-1>', boutton1)
 
    fen3.update()
 
    fen2.mainloop()
    fen3.mainloop()
 
    print " Sortie de la préparation au Jeu. "
    print ""
 
def Facile():
 
    global diff
 
    diff=1
 
def Moyen():
 
    global diff
 
    diff=2
 
def Difficile():
 
    global diff
 
    diff=3
 
def Moyenne():
 
    global n
 
    n=50
 
def Courte():
 
    global n
 
    n=25
 
def Longue():
 
    global n
 
    n=75
 
def Credits ():
 
    global credit, message8, message9, message10, message11, message12, message13, message14, message15, y7, y8, y9, y10, y11, y12, y13, y14, y15,u
 
    print " Entrée dans les crédits."
 
    credit = Toplevel()
    credit.title("Doge Walk / Crédits")
    #credit.attributes('-fullscreen', 1)
 
    Canvas_Credits = Canvas(credit, width=1920, height=1080)
    Canvas_Credits.grid(column=1,row=1)
 
    Canvas_Credits.bind('<Button-1>', Sautcredit)
 
    message7 = Canvas_Credits.create_text(960,1080,text="Credits", font ="Trebuchet 48", fill="red" )
    message8 = Canvas_Credits.create_text(960,1180,text="Developpeurs :", font ="Trebuchet 42 bold", fill="black" )
    message9 = Canvas_Credits.create_text(960,1280,text="Ewen Cossec & Louis-Marie Rauline", font ="Trebuchet 36", fill="black" )
    message10 = Canvas_Credits.create_text(960,1380,text="Images :", font ="Trebuchet 42 bold", fill="black" )
    message11 = Canvas_Credits.create_text(960,1480,text="Ewen Cossec & Louis-Marie Rauline", font ="Trebuchet 36", fill="black" )
    message12 = Canvas_Credits.create_text(960,1580,text="Musiques :", font ="Trebuchet 42 bold", fill="black" )
    message13 = Canvas_Credits.create_text(960,1680,text="Joseph Duclos", font ="Trebuchet 36", fill="black" )
    message14 = Canvas_Credits.create_text(960,1780,text="Beta-Testeurs :", font ="Trebuchet 42 bold", fill="black" )
    message15 = Canvas_Credits.create_text(960,1880,text="Joseph Duclos & Pierre Poisnel", font ="Trebuchet 36", fill="black" )
 
    for i in range(1000000):
 
        u=u+1
 
        y7 = 1080-u
        y8 = 1180-u
        y9 = 1280-u
        y10 = 1380-u
        y11 = 1480-u
        y12 = 1580-u
        y13 = 1680-u
        y14 = 1780-u
        y15 = 1880-u
 
        print y7, y8, y9, y10
 
        Canvas_Credits.coords(message7, 960, y7)
        Canvas_Credits.coords(message8, 960, y8)
        Canvas_Credits.coords(message9, 960, y9)
        Canvas_Credits.coords(message10, 960, y10)
        Canvas_Credits.coords(message11, 960, y11)
        Canvas_Credits.coords(message12, 960, y12)
        Canvas_Credits.coords(message13, 960, y13)
        Canvas_Credits.coords(message14, 960, y14)
        Canvas_Credits.coords(message15, 960, y15)
 
        credit.update()
 
    credit.update()
 
def Sautcredit (event):
 
    Quittercredit() #Close
 
    print"+1"
    credit.update()
 
def Quittercredit():
 
    global credit
 
    credit.quit()
    credit.destroy()
 
    Menu()
 
def Options():
 
    print " Entrée dans les options. "
 
    option = Toplevel()
    option.title("Doge Walk / Options")
 
    Canvas_Options = Canvas(option, width=500, height=300, background='darkgray')
    Canvas_Options.pack()
 
    option.update()
 
def Generation_Terrain():
 
    global n,r,s,Sol,rektangle,x1,x2,y1,y2,xx1,xx2,yy2,yy1,Perso
 
    Sol=[]
 
    for i in range(n):
 
        r=random.randrange(2)
 
        if r==0:
            s=s-1
            if s==-1:
                s=s+1
        elif r==1:
            s=s+1
            if s==s-1:
                s=s-1
 
        Sol.append(s)
 
        print "| i = ",i," | s = ",s," |"
 
    rektangle=[]
 
    for i in range(n):
 
        x1=0+300*i
        y1=1080-(40+Sol[i]*20)
        x2=300+300*i
        y2=1080
 
        if i==n-1:
 
            c="black"
 
        if i!=n-1:
 
            r2=random.randrange(11)
 
            if r2==0:
 
                c="green"
 
            if r2==1:
 
                c="purple"
 
            if r2==2:
 
                c="blue"
 
            if r2==3:
 
                c="yellow"
 
            if r2==4:
 
                c="red"
 
            if r2 ==5:
 
                c="orange"
 
            if r2 ==6:
 
                c="light green"
 
            if r2 ==7:
 
                c="dark green"
 
            if r2 ==8:
 
                c="brown"
 
            if r2 ==9:
 
                c="light blue"
 
            if r2 ==10:
 
                c="dark blue"
 
 
 
        rektangle.append(Canvas_Jeu.create_rectangle(x1,y1,x2,y2, fill=c))
 
    Perso = Canvas_Jeu.create_oval(125,y1+50,175,y1,fill="red")
    fen2.update()
 
def boutton1(event):
 
    global fen3
 
    fen3.quit()
    fen3.destroy()
 
    Jeu()
 
def Jeu():
 
    global fen2,Canvas_Jeu,s,n,rektangle,Sol,x1,x2,y1,y2,z,img4,p,diff,sc
 
    print " Entrée dans le Jeu Principal. "
    print ""
 
    Generation_Terrain()
 
    #print n
 
    Canvas_Jeu.bind('<Button-1>',Saut)
 
    i=0
 
    for l in range(10000000):
 
 
        for i in range(n):
 
            x1=(0+300*i)-z
            y1=1080-(40+Sol[i]*20)
            x2=(300+300*i)-z
            y2=1080
 
            #print" x1 = ",x1," y1 = ",y1," x2 = ",x2," y2 = ",y2
 
            Canvas_Jeu.coords(rektangle[i],x1,y1,x2,y2)        
 
        z=z+1
 
        nplaque = int(z/150+1)/2
 
        if diff==2 :
 
            rien="rien"
 
        if diff==1 :
 
            print z
 
        if p>10:
 
            Canvas_Jeu.coords(Perso,125,1080-(111+(Sol[nplaque]*20)),175,1080-(61+Sol[nplaque]*20))
 
        if p<=10:
 
            Canvas_Jeu.coords(Perso,125,1080-(91+(Sol[nplaque]*20)),175,1080-(41+Sol[nplaque]*20))
 
        p=p-1
 
        if p==-1:
 
            p=0
 
        if p==0:
 
            if nplaque!=n-1:
 
                if Sol[nplaque]<Sol[nplaque +1] and (300*(nplaque)+150)-25< z:
 
                    for i in range(10000000):
 
                        if p<50:
 
                            sc=sc+1
 
                            fen2.update() # | Bloque le programme sans le faire buguer. |
 
        print p
 
        if nplaque+1==n:
 
            Felicitations()
 
        fen2.update()
 
    print " Sortie du Jeu Principal. "
    print ""
 
def Felicitations():
 
    fen2.quit()
    fen2.destroy()
 
    Felicitation = Toplevel()
    Felicitation.title("Doge Walk / Félicitation !!")
    #Felicitation.attributes('-fullscreen', 1)
 
    Canvas_Options = Canvas(Felicitation, width=1920, height=1080, background='darkgray')
    Canvas_Options.pack()
 
 
 
 
 
def Saut (event):
 
    global s,n,rectangles,Sol,xx1,xx2,yy1,yy2,Perso,nplaque,p
 
    X = event.x
    Y = event.y
 
    p=100
    #print p
    if 1800<X<1910 and 0<Y<75:
 
        Close() #Close
 
    print"+1"
    fen2.update()
 
def Close():
 
    fen2.quit()
    fen2.destroy()
    fen.quit()
    fen.destroy()
    quit()
 
def P():
 
    global p
 
    print p
 
    p=0
 
 
#------------------------------------------------------------------------------#
#--------------------------- Programme Principal ------------------------------#
#------------------------------------------------------------------------------#
 
Initialisation()
Menu()