-
Notifications
You must be signed in to change notification settings - Fork 0
/
Winter Wonder part 5
738 lines (639 loc) · 31.4 KB
/
Winter Wonder part 5
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
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
from tkinter import *
import pygame
from pygame.locals import *
import random
from PIL import Image
import PIL as PIL
Samychooses=800
sprinklelocationx=700
sprinklelocationy=80
frostinglocationx=700
frostinglocationy=280
cherrylocationx=700
cherrylocationy=675
cookielocationx=100
cookielocationy=675
spurklelocationx=100
spurklelocationy=75
frostingwinterlocationx=100
frostingwinterlocationy=280
sprinkleworks=0
otherboxworks=0
other3boxworks=0
other4boxworks=0
other5boxworks=0
other6boxworks=0
other7boxworks=0
dog=0
spurkleposx = [0]
spurkleposy = [0]
hey=0
heyy=0
switchbases=1
cupsss=0
frostingsss=0
frostingwintersss=0
root = Tk()
root.withdraw() #https://stackoverflow.com/questions/15046498/toplevel-in-tkinter-prevent-two-windows-from-opening
unicorn=Toplevel()
colors=("Red", "Pink", "Blue", "White", "Green", "paleturquoise", "indianred", "limegreen", "crimson", "blueviolet", "khaki", "beige")
sprinklecolors=((250, 0, 0), (0, 0, 0), (0, 250, 0), (0, 0, 250))#("Red", "Brown", "Blue", "White", "Green", "Purple", "Yellow", "Orange")
cupcakecolor=((250, 0, 0), (0, 0, 0), (0, 250, 0), (0, 0, 250), (100, 100, 100))
number=0
cupchoice=(cupcakecolor[0])
print(cupchoice)
sprinkles = random.choice (sprinklecolors)
# change these colors to their numbers in pygame
def playbuttonpressed():
global tiggers
global buttonnumber
unicorn.quit()
tiggers = 1
#buttonnumber=3
unicorn.title("Winter Wonder")
global tink
tink=800
unicorn.wm_minsize(800, 800)
nutterbutter=0
def nutella():
print("hey")
global nutterbutter
nutterbutter=1
def nutella2():
global nutterbutter
global taco
nutterbutter=2
taco=random.choice(colors)
def mousey(event):
global nuttterbutter
print("hi")
if nutterbutter==1:
print ("hit")
global Samychooses
global google
global unicorncanvas
global boogle
google = PhotoImage (file="Winter Wonder Title.png", width=tink, height=tink) # going to add more images
boogle = unicorncanvas.create_image (tink/2, tink/2, image=google)
unicorncanvas = Canvas(unicorn, bg="paleturquoise", width=tink, height=tink)
unicorncanvas.grid (rowspan=5, columnspan=5)
Title=Label(unicorn, text="Winter Wonder", fg="royalblue", bg="White", font="Versalli", height=10, width=40)
Title.grid(row=1, column=2)
Playbutton=Button(unicorn, text="Play", fg="White", bg="royalblue", height=5, width=30, command =playbuttonpressed)
Playbutton.grid(row=2, column=2)
def SpartanSphere(event):
if nutterbutter==2:
global size2
size2=10
x1, y1=(event.x-size2),(event.y-size2)
x2, y2=(event.x+size2),(event.y+size2)
pbandj=unicorncanvas.create_oval(x1, y1, x2, y2, fill=taco, outline=taco, width=4) #going to add more colors
motion = Button (unicorn, text="paint on the title", bg="lightseagreen", fg="White", command=nutella2)
motion.grid (row=3, column=3)
wombat = Button (unicorn, text="Press twice for images", bg="lightseagreen", fg="White", command=nutella)
wombat.grid(row=3, column=1)
motion.bind("<B1-Motion>", SpartanSphere)
unicorncanvas.bind("<B1-Motion>", SpartanSphere)
wombat.bind("<Button-1>", mousey)
unicorn.mainloop()
unicorn.quit()
if tiggers==1:
unicorn.quit ()
question =Tk()
question.title("Options")
def option0():
global buttonnumber
buttonnumber=0
question.quit ()
def option1():
global buttonnumber
buttonnumber=1
question.quit ()
def option2():
global buttonnumber
buttonnumber=2
question.quit()
def option3():
global buttonnumber
buttonnumber=3
question.quit ()
Story0=Button(question, text="How to Play", bg="royalblue", fg= "White", command=option0)
Story0.pack()
Story1=Button(question, text="Story Mode", bg="royalblue", fg= "White", command=option1)
Story1.pack()
Story2=Button(question, text="Cupcake Creation", bg="royalblue", fg= "White",command=option2)
Story2.pack ()
Story3=Button(question, text="Bonus Meme level", bg="royalblue", fg= "White", command=option3)
Story3.pack ()
question.mainloop()
if buttonnumber==0:
blarf = Tk ()
Instructions=Text(blarf, height=30, width=130)
Instructions.pack()
Instructions.insert(END, "Instructions: There are three options to play on. First option is story mode where you click the left and right buttons to play.\n You can die in that game, so be careful or you have to restart the entire game. \n"
"Option 2 is a cupcake maker where you have to click on the boxes in order to initiate movement of the decorations.\n Click on the location you want to put the decorations. If you want the decoration to be set down, right click.\n "
"If you want to choose a decoration, left click on the box. If the decoration is outside its box,\n and you have already set it down, you can move it around again by clicking on the box.\n"
"In top right corner there is x button, after you are done learning these instructions, click that button and all other x buttons and run the game again.\n Option 3 is a bonus meme level, where you can see all the extra features combined")
blarf.mainloop()
if buttonnumber ==2:
fps = pygame.time.Clock ()
print("hiya")
pygame.init()
pygame_color=(250, 250, 250)
pygame_color2=(250, 250, 0)
pygame_color3=(250, 0, 250)#pink
pygame_color4=(0, 250, 250)
pygame_color5=(250, 0, 0) #Red
pygame_color6=(0, 0, 250)
pygame_color7=(0, 0, 0) #black
pygame_color8=(0, 250, 0) #green
screen=pygame.display.set_mode((800,800))
pygame.display.set_caption("Cupcake Factory")
working=True
x=(800/2)-205
y=(800/2)+100
sizeheight=250
sizewidth=400
#going to do something hwere you click to go get cupcake
def spurrkles():
global spurkleposx, spurkleposy, hey, heyy
if held==True:
if other6boxworks==1:
hey=0
heyy=0
hey += random.randint (-150, 150)
heyy += random.randint (-150, 150)
if len(spurkleposx)<20:
spurkleposx.append(hey)
spurkleposy.append (heyy)
else:
del spurkleposx[1:10] #https://stackoverflow.com/questions/11520492/difference-between-del-remove-and-pop-on-lists
del spurkleposy[1:10]
#in cupcake:
def inCupcake():
global sprinkles, sprinklecolors, sprinklesize, sprinklebox, sprinkleworks
global sprinks, sprinks2, sprinks3, sprinks4, sprinks5, sprinks6, sprinks7, sprinks8
global otherbox, other2box, other3box, other4box, other5box, other6box, other7box
global held, spurkleposx, spurkleposy, other7boxworks, switchbases
global coordinates, cup, cupsss, cupchoice, number, frostingsss, frostinglocationx, frostinglocationy
global xcoordinate, ycoordinate, winterornot, cherrylocationx, cherrylocationy, cherryline
global sprinklelocationx, frostingwinter7, frostingwinter8, spurklelocationx, spurklelocationy
global sprinklelocationy, frostingsizex, frostingsizey, cookielocationx, cookielocationy
global other2boxworks, other3boxworks, otherboxworks, other4boxworks, other5boxworks, other6boxworks
global frosting, frosting2, frosting3, frosting4, frosting5, frosting6, frosting7, frosting8
global frostingwintersss, frostingwinlocationx, frostingwinlocationy, frostingwintersss
global frostingwinter, frostingwinter2, frostingwinter3, frostingwinter4, frostingwinter5, frostingwinter6
sprinklesize=10
frostingsizex=350
frostingsizey=175
#if startcupcakeifyouclickponcupcakeimageinconerbelt==1:
workmaybe = pygame.image.load ("Winter Wonder Title.png") # https://www.youtube.com/watch?v=_1dPkU8c6VA
screen.blit (workmaybe, (0, 0)) # https://www.youtube.com/watch?v=_1dPkU8c6VA
#x=x+1
sprinklebox=pygame.draw.rect (screen, pygame_color5, [600, 0, 200, 150])
otherbox = pygame.draw.rect (screen, pygame_color7, [600, 200, 200, 150])
other2box = pygame.draw.rect (screen, pygame_color, [600, 400, 200, 150])
other3box = pygame.draw.rect (screen, pygame_color3, [600, 600, 200, 150])
other4box = pygame.draw.rect (screen, pygame_color7, [0, 200, 200, 150])
other5box = pygame.draw.rect (screen, pygame_color3, [0, 400, 200, 150])
other6box = pygame.draw.rect (screen, pygame_color5, [0, 0, 200, 150])
other7box = pygame.draw.rect (screen, pygame_color, [0, 600, 200, 150])
if event.type == MOUSEBUTTONDOWN: # https://stackoverflow.com/questions/34601588/how-to-move-image-with-mouse-in-pygame
held = True
sprinkles = random.choice (sprinklecolors)
else:
held=False
if held==True:
coordinates=pygame.mouse.get_pos()
print(coordinates)
xcoordinate=int(coordinates[0])
ycoordinate = int(coordinates[1]) #https://stackoverflow.com/questions/29311819/how-to-convert-tuple-type-to-int-on-python
def workornot():
global sprinkleworks, otherboxworks, other2boxworks, other3boxworks, other4boxworks
global other5boxworks, other6boxworks, other7boxworks
sprinkleworks=0
otherboxworks=0
other2boxworks=0
other3boxworks=0
other4boxworks=0
other5boxworks=0
other6boxworks=0
other7boxworks=0
if event.type == pygame.MOUSEBUTTONDOWN:
if event.button == 3:
print ("hey")
xcoordinate = xcoordinate
ycoordinate = ycoordinate
workornot ()
if sprinklebox.collidepoint(pygame.mouse.get_pos()): #https://stackoverflow.com/questions/12150957/pygame-action-when-mouse-click-on-rect
workornot ()
sprinkleworks=1
if sprinkleworks==1:
sprinklelocationx = 0
sprinklelocationy= 0
sprinklelocationx+=xcoordinate
sprinklelocationy+=ycoordinate
if otherbox.collidepoint(pygame.mouse.get_pos()):
workornot ()
otherboxworks = 1
if otherboxworks == 1:
print (otherboxworks)
frostingsss=1
winterornot=0
frostinglocationx = 0
frostinglocationy = 0
frostinglocationx += xcoordinate-175
frostinglocationy += ycoordinate-100
if other2box.collidepoint(pygame.mouse.get_pos()):
workornot ()
other2boxworks = 1
cupchoice=(cupcakecolor[number])
if number<4:
number=number+1
else:
number=0
if other2boxworks ==1:
cupsss=1
if other3box.collidepoint(pygame.mouse.get_pos()):
workornot ()
other3boxworks = 1
if other3boxworks==1:
cherrylocationx = 0
cherrylocationy = 0
cherrylocationx += xcoordinate
cherrylocationy += ycoordinate
if other4box.collidepoint(pygame.mouse.get_pos()):
print ("%%%%%%%4")
workornot ()
other4boxworks = 1
winterornot = 1
if other4boxworks==1:
frostingwintersss = 1
frostingwinlocationx = 0
frostingwinlocationy = 0
frostingwinlocationx += xcoordinate - 175
frostingwinlocationy += ycoordinate - 100
if other5box.collidepoint(pygame.mouse.get_pos()):
workornot ()
other5boxworks = 1
if other5boxworks==1:
print("5")
switchbases=random.randint(0,1)
if other6box.collidepoint(pygame.mouse.get_pos()):
print ("6")
workornot ()
other6boxworks=1
if other6boxworks==1:
circular=1
spurklelocationx = 0
spurklelocationy = 0
spurklelocationx += xcoordinate
spurklelocationy += ycoordinate
if other7box.collidepoint(pygame.mouse.get_pos()):
print ("%%%%%%%7")
workornot ()
other7boxworks = 1
if other7boxworks ==1:
cookielocationx = 0
cookielocationy = 0
cookielocationx += xcoordinate
cookielocationy += ycoordinate
if switchbases == 1:
cupbasevanilla = pygame.image.load ("Vanilla Cupcake.png")
# Code from here to
cupbasevanilla = pygame.transform.scale (cupbasevanilla, (600,
600)) # https://stackoverflow.com/questions/20002242/how-to-scale-images-to-screen-size-in-pygame
vanillarect = cupbasevanilla.get_rect ()
vanillarect = vanillarect.move ((105, 800 - 600))
screen.blit (cupbasevanilla, vanillarect)
elif switchbases == 0:
cupbasechocolate = pygame.image.load ("Chocolate Cupcake.png")
cupbasechocolate = pygame.transform.scale (cupbasechocolate, (600, 600))
chocolaterect = cupbasechocolate.get_rect ()
chocolaterect = chocolaterect.move ((105, 800 - 600))
screen.blit (cupbasechocolate, chocolaterect)
# to here was helped by: https://stackoverflow.com/questions/20002242/how-to-scale-images-to-screen-size-in-pygame
if cupsss==1:
cup = pygame.draw.polygon (screen, cupchoice,
[[x, y], [x + 50, y + sizeheight], [x + sizewidth - 50, y + sizeheight],
[x + sizewidth, y]])
frosting=pygame.draw.ellipse (screen, pygame_color6, [650, 275, 100, 50]) #this is menu forsting
frosting2 = pygame.draw.ellipse (screen, pygame_color3, [650+12, 255, 75, 50])
frosting3 = pygame.draw.ellipse (screen, pygame_color2, [650+24, 235, 50, 45])
frosting4 = pygame.draw.ellipse (screen, pygame_color, [650+30, 225, 40, 30])
if frostingsss==1 and winterornot==0:
frosting5 = pygame.draw.ellipse (screen, pygame_color, [frostinglocationx, frostinglocationy, frostingsizex, frostingsizey])
frosting6 = pygame.draw.ellipse (screen, pygame_color3, [frostinglocationx + 12, frostinglocationy-20, frostingsizex-25, frostingsizey-30])
frosting7 = pygame.draw.ellipse (screen, pygame_color4, [frostinglocationx + 24, frostinglocationy-40, frostingsizex-50, frostingsizey-60])
frosting8 = pygame.draw.ellipse (screen, pygame_color5, [frostinglocationx + 48, frostinglocationy-60, frostingsizex-100, frostingsizey-90])
frosting10 = pygame.draw.ellipse (screen, pygame_color6, [frostinglocationx + 70, frostinglocationy-80, frostingsizex-150, frostingsizey-110])
frosting11 = pygame.draw.ellipse (screen, pygame_color7, [frostinglocationx + 110, frostinglocationy-100, frostingsizex-230, frostingsizey-120])
frostingwinter = pygame.draw.ellipse (screen, pygame_color, [0, 275, 100, 50])#this is menu winterfrosting
frostingwinter2 = pygame.draw.ellipse (screen, pygame_color6, [0 + 12, 255, 75, 50])
frostingwinter3 = pygame.draw.ellipse (screen, pygame_color, [0 + 24, 235, 50, 45])
frostingwinter4 = pygame.draw.ellipse (screen, pygame_color6, [0 + 30, 225, 40, 30])
if frostingwintersss == 1 and winterornot==1:
frostingwinter5 = pygame.draw.ellipse (screen, pygame_color6,
[frostingwinlocationx, frostingwinlocationy, frostingsizex, frostingsizey])
frostingwinter6 = pygame.draw.ellipse (screen, pygame_color,
[frostingwinlocationx + 12, frostingwinlocationy - 20, frostingsizex - 25,
frostingsizey - 30])
frostingwinter7 = pygame.draw.ellipse (screen, pygame_color6,
[frostingwinlocationx + 24, frostingwinlocationy - 40, frostingsizex - 50,
frostingsizey - 60])
frostingwinter8 = pygame.draw.ellipse (screen, pygame_color,
[frostingwinlocationx + 48, frostingwinlocationy - 60, frostingsizex - 100,
frostingsizey - 90])
frostingwinter10 = pygame.draw.ellipse (screen, pygame_color6,
[frostingwinlocationx + 70, frostingwinlocationy - 80, frostingsizex - 150,
frostingsizey - 110])
frostingwinter11 = pygame.draw.ellipse (screen, pygame_color,
[frostingwinlocationx + 110, frostingwinlocationy - 100, frostingsizex - 230,
frostingsizey - 120])
cherry = pygame.draw.circle (screen, pygame_color5, (cherrylocationx, cherrylocationy), 30)
cherryline = pygame.draw.line (screen, pygame_color5, (cherrylocationx, cherrylocationy-15),(cherrylocationx+30, cherrylocationy-65))
cookie = pygame.draw.circle (screen, pygame_color7, (cookielocationx+7, cookielocationy+7), 40)
cookie2 = pygame.draw.circle (screen, pygame_color, (cookielocationx+3, cookielocationy+3), 40)
cookie3 = pygame.draw.circle (screen, pygame_color7, (cookielocationx, cookielocationy), 40)
spurrkles()
spurkles = pygame.draw.circle (screen, pygame_color8, (spurklelocationx+random.choice(spurkleposx), spurklelocationy+random.choice(spurkleposy)), 10)
spurrkles()
spurkles2 = pygame.draw.circle (screen, pygame_color2, (spurklelocationx, spurklelocationy), 10)
spurrkles ()
spurkles3 = pygame.draw.circle (screen, pygame_color5, (spurklelocationx+random.choice(spurkleposx), spurklelocationy+random.choice(spurkleposy)), 10,)
spurrkles ()
spurkles4 = pygame.draw.circle(screen, pygame_color4, (spurklelocationx+random.choice(spurkleposx), spurklelocationy+random.choice(spurkleposy)),10)
spurrkles ()
spurkles5 = pygame.draw.circle(screen, pygame_color, (spurklelocationx+random.choice(spurkleposx), spurklelocationy+random.choice(spurkleposy)), 10)
spurrkles ()
spurkles6 = pygame.draw.circle(screen, pygame_color7, (spurklelocationx+random.choice(spurkleposx), spurklelocationy+random.choice(spurkleposy)), 10)
spurrkles ()
spurkles7 = pygame.draw.circle(screen, pygame_color6, (spurklelocationx+random.choice(spurkleposx), spurklelocationy+random.choice(spurkleposy)), 10)
spurrkles ()
spurkles8 = pygame.draw.circle(screen, pygame_color3, (spurklelocationx+random.choice(spurkleposx), spurklelocationy+random.choice(spurkleposy)), 10)
sprinks=pygame.draw.line(screen, sprinkles, (sprinklelocationx, sprinklelocationy), (sprinklelocationx+sprinklesize, sprinklelocationy+sprinklesize))
sprinks2 = pygame.draw.line (screen, sprinkles, (sprinklelocationx-30, sprinklelocationy-40),
(sprinklelocationx + sprinklesize-30, sprinklelocationy + sprinklesize-40))
sprinks3 = pygame.draw.line (screen, sprinkles, (sprinklelocationx+10, sprinklelocationy-50),
(sprinklelocationx + sprinklesize+10, sprinklelocationy + sprinklesize-50))
sprinks4 = pygame.draw.line (screen, sprinkles, (sprinklelocationx+50, sprinklelocationy),
(sprinklelocationx + sprinklesize+50, sprinklelocationy + sprinklesize))
sprinks5 = pygame.draw.line (screen, sprinkles, (sprinklelocationx+20, sprinklelocationy-20),
(sprinklelocationx + sprinklesize+20, sprinklelocationy + sprinklesize-20))
sprinks6 = pygame.draw.line (screen, sprinkles, (sprinklelocationx-30, sprinklelocationy+30),
(sprinklelocationx + sprinklesize-30, sprinklelocationy + sprinklesize+30))
sprinks7 = pygame.draw.line (screen, sprinkles, (sprinklelocationx+50, sprinklelocationy-10),#black
(sprinklelocationx + sprinklesize+50, sprinklelocationy + sprinklesize-10))
sprinks8 = pygame.draw.line (screen, sprinkles, (sprinklelocationx-60, sprinklelocationy+5),
(sprinklelocationx + sprinklesize-60, sprinklelocationy + sprinklesize+5))
cup = pygame.draw.polygon (screen, sprinkles,# this is for the menu part
[[600, 450], [600+50, 550], [800-50, 550], [800, 450],]) # https://stackoverflow.com/questions/25018637/how-do-i-draw-a-polygon-in-python
while working == True:
for event in pygame.event.get ():
if event.type == QUIT:
working = False
if event.type==MOUSEBUTTONDOWN: #https://stackoverflow.com/questions/34601588/how-to-move-image-with-mouse-in-pygame
held=True
pygame.display.update ()
fps.tick (60)
inCupcake()
if buttonnumber==1:
import tkinter
from tkinter import *
from tkinter.font import Font
import time
window = tkinter.Tk ()
window.configure (bg="cyan")
window.title ("Story")
window.geometry ("800x400")
f = Font (family='courier', size=14)
def uniform():
yes.destroy ()
note.destroy ()
new.insert (INSERT, "\nYou enter the cave and see a pile of gold!\nYou are rich!")
new.insert (INSERT, "\nThanks for playing!")
q = Button (window, height=3, width=8, text="Quit", command=no)
q.pack (side=BOTTOM)
def foxtrot():
yes.destroy ()
note.destroy ()
new.insert (INSERT, "\nYou do not go in the cave.\nThe bear has returned!")
new.insert (INSERT, "\nYou are unprepared and the bear eats you.")
q = Button (window, height=3, width=8, text="Quit", command=no)
q.pack (side=BOTTOM)
def bravo():
global yes
global note
nothing.destroy ()
tie.destroy ()
new.insert (INSERT,
"\nYou tie your jacket around the wound.\nThe bleeding stops.\nYou finally reach the mountain.")
new.insert (INSERT, "\nYou see a cave.\nDo you enter?")
yes = Button (window, height=3, width=8, text="Yes!", command=uniform)
yes.pack (side=BOTTOM)
note = Button (window, height=3, width=8, text="NO!", command=foxtrot)
note.pack (side=BOTTOM)
def olive():
queen.destroy ()
whiskey.destroy ()
new.insert (INSERT, "\nYou open the box and a monster jumps out of it!\nYou get eaten.")
k = Button (window, width=8, height=3, text="Quit", command=no)
k.pack (side=BOTTOM)
def canary():
whiskey.destroy ()
queen.destroy ()
new.insert (INSERT, "\nYou walk away from the box and see another box!\nThis one looks like a treasure chest.\n"
"You open it and find gold!\nYou are rich!\nThanks for playing!")
slade = Button (window, height=3, width=8, text="Quit", command=no)
slade.pack (side=BOTTOM)
def jum():
global whiskey
global queen
jump.destroy ()
charlie.destroy ()
new.insert (INSERT, "\nYou successfully jump across the river.")
new.insert (INSERT,
"\nYou walk along the river bank towards the ocean.\nWhen you reach the ocean, you find a box in the sand.")
new.insert (INSERT, "\nDo you open it?")
whiskey = Button (window, height=3, width=8, text="Yes!", command=olive)
whiskey.pack (side=BOTTOM)
queen = Button (window, height=3, width=8, text="No!", command=canary)
queen.pack (side=BOTTOM)
def swi():
jump.destroy ()
charlie.destroy ()
new.insert (INSERT, "\nYou attempt to swim across, but drown.")
qu = Button (window, height=3, width=8, text="Quit", command=no)
qu.pack (side=BOTTOM)
def alpha():
global nothing
global tie
tie.destroy ()
nothing.destroy ()
new.insert (INSERT, "\nYou bleed out and die.")
qu = Button (window, height=3, width=8, text="Quit", command=no)
qu.pack (side=BOTTOM)
def ocea():
global jump
global charlie
mountains.destroy ()
ocean.destroy ()
new.insert (INSERT, "\nYou start walking to the ocean in the distance.")
new.insert (INSERT, "\nThere is a small river in your way.")
new.insert (INSERT, "\nDo you jump across or try to swim?")
jump = Button (window, height=3, width=8, text="Jump", command=jum)
jump.pack (side=BOTTOM)
charlie = Button (window, height=3, width=8, text="Swim", command=swi)
charlie.pack (side=BOTTOM)
def mount():
global nothing
global tie
mountains.destroy ()
ocean.destroy ()
new.insert (INSERT, "\nYou start walking towards the mountains in the distance.")
new.insert (INSERT, "\nWhile walking, you trip on a rock and start bleeding.")
new.insert (INSERT, "\nWhat do you do?")
nothing = Button (window, height=3, width=8, text="Do nothing", command=alpha)
nothing.pack (side=BOTTOM)
tie = Button (window, height=3, width=8, text="Stop Bleeding", command=bravo)
tie.pack (side=BOTTOM)
def no():
window.destroy ()
def deads():
global mountains
global ocean
dead.destroy ()
fight.destroy ()
new.insert (INSERT, "\nYou lay on the ground and play dead.")
new.insert (INSERT, "\nThe bear ignores you and walks away.")
new.insert (INSERT, "\nYou stand up and continue through the forest.")
new.insert (INSERT, "\nDo you want to go towards the mountains or the ocean?")
mountains = Button (window, height=3, width=8, text="Mountains", command=mount)
mountains.pack (side=BOTTOM)
ocean = Button (window, height=3, width=8, text="Ocean", command=ocea)
ocean.pack (side=BOTTOM)
def fights():
global dead
global fight
dead.destroy ()
fight.destroy ()
new.insert (INSERT, "\nYou run up to the bear and try to fight.\nThe bear is stronger than you and kills you.")
qu = Button (window, height=3, width=8, text="Quit", command=no)
qu.pack (side=BOTTOM)
def right():
global fight
global dead
left.destroy ()
right.destroy ()
new.insert (INSERT, "\nYou take the path to the right.")
new.insert (INSERT, "\nYou are walking down the right path, and you come across a bear.")
new.insert (INSERT, "\nWhat do you do?")
dead = Button (window, height=3, width=8, text="Play Dead", command=deads)
dead.pack (side=BOTTOM)
fight = Button (window, height=3, width=8, text="Attack", command=fights)
fight.pack (side=BOTTOM)
def left():
left.destroy ()
right.destroy ()
new.insert (INSERT, "\nYou take the path to the left.\nThis was the wrong descision.\nA rabid"
" lion is in your way.\nYou have no chance.\nYou get eaten.")
lance = Button (window, height=3, width=8, text="Quit", command=no)
lance.pack (side=BOTTOM)
# scrollbar and start
scroll = Scrollbar (window)
scroll.pack (side=RIGHT, fill=Y)
new = Text (window, font=f, height=13, yscrollcommand=scroll.set)
new.insert (INSERT, "Welcome to interactive story mode!")
new.insert (INSERT, "\nOne day, you were walking in the forest and you came across a path.\n")
new.insert (INSERT, "Do you go RIGHT or LEFT?")
right = Button (window, height=3, width=8, text="RIGHT", command=right)
right.pack (side=BOTTOM)
left = Button (window, height=3, width=8, text="LEFT", command=left)
left.pack (side=BOTTOM)
new.pack ()
window.mainloop ()
if buttonnumber==3:
hogwarts = Toplevel() #https://stackoverflow.com/questions/20251161/tkinter-tclerror-image-pyimage3-doesnt-exist
hogwartswidth=1000
hogwartsheight=800
hogwarts.title("Image manipulation")
hogwarts.wm_minsize(width=hogwartswidth, height=hogwartsheight)
size=30
shape=0
def Typecircle():
global shape
shape=1
def Typeimage():
global shape
shape=2
def Typepaint():
global shape
shape=3
canvas=Canvas(hogwarts, bg="Blue", width=hogwartswidth-40, height=hogwartswidth-40)
canvas.grid(row=1, columnspan=10)
circlebutton=Button(hogwarts, text="circle", command=Typecircle)
circlebutton.grid(row=2, column=1)
def CreateImage():
global image2
global imagelabel
global rawr
image2=PhotoImage(file="Winter Wonder Title.png", width=900, height=900)
imagelabel=Label(master=canvas, image=image2)
imagelabel.grid (row=2, column=3)
tiggers=0
if tiggers==1:
rawr = canvas.create_image (hogwartswidth/2,hogwartswidth/2, image=image2)
addimagebackground=Button(hogwarts, text="Get Memed", command=CreateImage)
addimagebackground.grid(row=2, column=2)
actualimage=Button(hogwarts, text="Add image", command=Typeimage)
actualimage.grid(row=2, column=4)
def click(event):#https://stackoverflow.com/questions/29789554/tkinter-draw-rectangle-using-a-mouse
print ("Mouse position: (%s %s)" % (event.x, event.y))
global shape
global image2
global puppy
global ypos
global xpos
if shape==1:
print(shape)
dog=canvas.create_oval(event.x-size, event.y-size, event.x+size, event.y+size, fill="White", outline="Black", width=3) #https://stackoverflow.com/questions/36427858/trouble-creating-oval-widgets-in-python-tkinter
if shape==2:
print(shape)
image2 = PhotoImage (file="Vanilla Cupcake.png", width=size*8, height=size*8)
if event.x>60:
xpos=event.x
ypos=event.y
puppy=canvas.create_image(xpos, ypos, image=image2) # only helped by all sources including https://stackoverflow.com/questions/20015030/python-2-7-how-to-add-images-on-the-canvas-with-tkinter
print(event.x)
circlebutton.bind("<Button-1>", click)
canvas.bind("<Button-1>", click)
actualimage.bind("<Button-1>", click)
# the sucky parts:
class Hi(object):
def __init__(self, ughaclass=3, letsnotuseclasses=1):
self.ughaclass=1
self.ughaclass+=1
array=([1, 4, 5, 7])
print(array)
Hi()
#From here to
if dog==0:
import matplotlib.pyplot as plt
import numpy as np
plt.axis("off")
plt.ylabel("THIS IS X")
plt.xlabel ("THIS IS Y")
image=plt.imread("Winter Wonder Title.png")
lol_image=image[:,:,0]
imageplot = plt.imshow (lol_image)
plt.colorbar(imageplot)
print(len(image))
x = np.linspace (14, 53, 10)
plt.plot ([1, 2, 3], label='What?')
plt.plot (x + 2, x + 5, label='up?')
plt.plot (x - 3, x + 6 * x, label='People?')
plt.title ("Heyyyyyooooo")
plt.pause (5)
dog = 1
#here is from https://matplotlib.org/faq/usage_faq.html and https://matplotlib.org/users/image_tutorial.html
hogwarts.mainloop()