From 1f8baae5037228bf9a31ca4553376e5ab0faa695 Mon Sep 17 00:00:00 2001 From: Sebasdevrs <61840665+Sebasdevrs@users.noreply.github.com> Date: Wed, 19 May 2021 08:59:33 +0200 Subject: [PATCH] update_week3 Created a function for calling a random image in notes_test, and created a test for this function in test_notes Under TestRandomNote --- musical_notes/__init__.py | 2 +- .../__pycache__/__init__.cpython-36.pyc | Bin 239 -> 216 bytes .../__pycache__/notes_test.cpython-36.pyc | Bin 3690 -> 3380 bytes musical_notes/notes_test.py | 14 +++++--------- .../__pycache__/test_notes.cpython-36.pyc | Bin 670 -> 1107 bytes musical_notes/test/test_notes.py | 16 +++++++++++----- 6 files changed, 17 insertions(+), 15 deletions(-) diff --git a/musical_notes/__init__.py b/musical_notes/__init__.py index 8eb02a9..6751eb0 100644 --- a/musical_notes/__init__.py +++ b/musical_notes/__init__.py @@ -1 +1 @@ -from musical_notes.notes_test import game_notes, random_image \ No newline at end of file +from musical_notes.notes_test import game_notes \ No newline at end of file diff --git a/musical_notes/__pycache__/__init__.cpython-36.pyc b/musical_notes/__pycache__/__init__.cpython-36.pyc index 5ac0e62d2481dd668eb0627f16aa034609f3045b..b148aaf1d4211361c747a41d042cf66924029ee3 100644 GIT binary patch delta 99 zcmaFQc!SZ;n3tC;S$Ii;J_7^8V<3hDCLqfJh>Hb)L<&O+V-7Qy!?{XVn0o$i3#$YD;bJdfO17F6MK^YSnd;K delta 122 zcmcb?_?|Jrn3tF9#nZ(JwhRmmkAWBtn1Cz?ATAaG5-AKRj5!Rsj8TlaOi@gX3@J>( z44TX@fieu5Ot-kw6LVAJ^YTkli*NB1CFZ5%=f-E|CZ?zQX);grljkd92C7@hP{azP KidZL>B>@02$Q#E1 diff --git a/musical_notes/__pycache__/notes_test.cpython-36.pyc b/musical_notes/__pycache__/notes_test.cpython-36.pyc index 223031ca1fcc6062638f51e79c1a3e2280936daa..2f5506a6e7ab92de090bd84b8abe96ea7025f6bc 100644 GIT binary patch delta 1120 zcmZWo&1(}u6rYdX&2F*@G5ttCqNz>O5?Y~BtslkOre7+t3Kb7QShtyNNli8~I|Y%1 z9_k?=LCWA?U@v+T_2|ui!0TQGL9bqVbY`=mMHlAH+u!@W_kOc)_IKv%Ue9kO=(0S>ML;ccyR`W9Jx!*isXo7KwuL#!7xYzg3@3M6!0cT zdM@)G6p*jD`}OUzQLWp%POa)Os)-D$@ddaw5P-Xm8m|0cnAp`0*9!DNWaj80!;&H(85gJ(^zCrZ{kD2 zvJHmXm>FcSgIY>c*#jg^hB^=e7HwmaBcmN;$5`wPZVEiphU9z)x74O8A{W98vwahj zY#Rk3t*MF7SQrvb$VDmjh-12#fnqX#U9z;X{LhCs0kPzV5rdY*sLZ^0P0}m#SJod=yTYm!NA$ccnN!kS z zAhP93i9{siL$vB&fH-i56KDPaxb6`Sh@81_g7?-oF<-ly-^~8rd;8wL`OSV?yjUr{ zIWv_Zf7=ah&&|vJqh^_!ABB-K0dIHf){|+j#vA&h zJci*r=P>lA__mDc+_*8onw!Rsqr6Bp&7C`=g|Ry(b|=K%nAn>T_s7Kj2~i&t^$D>(CblO; zZA{cg1WM&0q#x-7H*X(Cv;pvMtq9(uJ+@31L9C0U&(p8aN7|7lgq(j@YNYyseZ)Pi zXfgwnL}kbvKyxIXPi~oqEKg_II=77Z_`>>P zfGvT#mSK`bfF$=YI1Huls&*JusKnwcT;4!Cc3j>>f=cWG#JvtvQouUkfE|Vh;it}_ zbp3Jb(yrOl)(7Ap;W;4Gpm};6|CafF`3^kF+X$Csdk6CZ!ZCEv}C(>=HcFTjD zchU12!e;z_u0|K)7rDJbx{HY>!%)dLFeKxvh3hm$MNbQtX<}@UTtY}o zNSlVI6nh_)0SGr}mS(x76*lrlK5J2%TTndS7MVT^9=ATsF BG{gV^ diff --git a/musical_notes/notes_test.py b/musical_notes/notes_test.py index 6db72e0..5677a1d 100644 --- a/musical_notes/notes_test.py +++ b/musical_notes/notes_test.py @@ -4,12 +4,9 @@ from PIL import ImageTk, Image from random import randint +def imagegen(numb, imagelist): + return "musical_notes/musicalnotes/" + imagelist[numb]+".png" -class random_image: - # Random number generator: - def __init__ (self, inputlist): - randnumb = randint(0, len(inputlist)-1) - return randnumb class game_notes: @@ -41,13 +38,12 @@ def start_note_practice (): notes_list = ['C_test', 'C1_test', 'D_test', 'D1_test', 'E_test', 'E1_test', 'F_test', 'F1_test', 'G_test', 'G1_test', 'A_test', 'A1_test', 'B_test', 'B1_test'] # Random number generator: - def randimg (self, inputlist): - randnumb = randint(0, len(inputlist)-1) - randnote = "musical_notes/musicalnotes/" + inputlist[randnumb]+".png" + randnumb = randint(0, len(notes_list)-1) + randnote = "musical_notes/musicalnotes/" + notes_list[randnumb]+".png" # Creating images: global note_image - note_image = ImageTk.PhotoImage(Image.open(randimg(notes_list))) + note_image = ImageTk.PhotoImage(Image.open(randnote)) show_note = Label(start_note_practice_frame, image=note_image) show_note.pack(pady=15) diff --git a/musical_notes/test/__pycache__/test_notes.cpython-36.pyc b/musical_notes/test/__pycache__/test_notes.cpython-36.pyc index c72b45a3d62b75febbf20256bdd1cabf4b31792b..85dd844d96f80d99444b25bc94c81d13641ef864 100644 GIT binary patch literal 1107 zcma)5&2G~`5Z+xoiR;uMlp=9J;)FylsoLHULT!^Y5{Dq5Tvm~c@hp*>*a=<-iK@5s zJ-8qw9)Oqel~Z1U6Ej{LB^;m|?fiT@nb~hJ+c}5$u<`H>;$(Sp#TPa z#-!1_)Itix#mtIrX~#8L<7~*l0{e!6t=MIKWyywepf(lh3-otZjANcRtW#fOPB!X@ z+?@om@{@U{bnZlPFi{hggmhXhfyN1Ly^lgM$$?>A4&sJM3oOiL=dBB+v)4fa^LT`* zLXM%dNVjqKaO-as|gOAH#*5SFW)$GG}meP%Xz3M$3zr|BM*6Mwr$1fArPoqz2 z+@FWbSS6WC##?;;@~G8g5{7Me@j3VYxQi&9?qU^9g7GKx6D{82R}U|?9$$CsFC%=N zj_)V*%KhB+{df+`8QHtOPbADqN?8jQ8=^@VeTHOcnuo&+pEAZll=yzfmCiDWGO8)P z%Ie1Ra4H+wG(yg)e6U5jTTHK*cuF~oX6Fu(=mpq4DwujGa+_*w+=rT+(p_@rnW6EV SKCq%A4tIoOwe3CE;lBa8&n(3N delta 407 zcmYjMu}T9$5S`tR1^$|+5};}cpJ%S?qK%{k%-0l1L3S~ zto#6be?jcFwX*OBtei;^GBA&w-8b*O{gN-0=0?32%e5Upw;qEtZSxLI zS7NRB_|)q`h@