-
PeterG
Letter to Ole about a new turtle.py is not meaningful, because the version uses uses tkinter NOT available on an iphone. Read about it just 11.6.2921.
For other systems it seams to be much more in speed with two nice examples included..
Have a nice day
Peter ( or PKHG ...) -
PeterG
Problem solved, new phone has below left either abc or 123 button and that is start first too other 123 cides shows a lot of other signs
Thanks
-
PeterG
Hi on my ipone old iphon 6 new iohone mini with (old?) pythonista 3 no multipov
Cation star avalable??? How to get it /(1/x) is annoying ... -
PeterG
@ccc, just something I need , very nice indeed! I import a game, that for grand-son and daughter, and run it before the background cardimages are shown, meeaning I am on the way for an 4-level game ...
Next try, just using one of the marvallous available games , as next levels ..
.. Topscore files will be used for further interaction ..Thanks to your example ... Helps a lot 😊 , happy OpaPeter
-
PeterG
@ccc very nice example.
What and why flex=name ? Can't find the meaning of it -
-
PeterG
#! python2 # Piano # # A simple multi-touch piano. from scene import * import sound from itertools import chain class Key (object): def __init__(self, frame): self.frame = frame self.name = None self.touch = None self.color = Color(1, 1, 1) self.highlight_color = Color(0.9, 0.9, 0.9) def hit_test(self, touch): return touch.location in self.frame class Piano (Scene): def setup(self): self.white_keys = [] self.black_keys = [] white_key_names = ['Piano_C3','Piano_D3', 'Piano_E3', 'Piano_F3', 'Piano_G3', 'Piano_A3', 'Piano_B3', 'Piano_C4', 'Piano_D4', 'Piano_E4', 'Piano_F4', 'Piano_G4'] #white_key_names_nogniiet = #['Piano_02','Piano_D2','Piano_E2','Piano_F2','Piano_G2','Piano_A2','Piano_B2','Piano_C3'] black_key_names = ['Piano_C3#', 'Piano_D3#', 'Piano_F3#', 'Piano_G3#', 'Piano_A3#', 'piano:C4#', 'Piano_D4#', 'Piano_F4#'] for key_name in chain(white_key_names, black_key_names): sound.load_effect(key_name) white_positions = range(12) black_positions = [0.5, 1.5, 3.5, 4.5, 5.5, 7.5, 8.5, 10.5] key_w = self.size.w / 2# pkhg factor 0.5 key_h = self.size.h / 8 /2 for i in range(len(white_key_names)): pos = white_positions[i] key = Key(Rect(0, pos * key_h, key_w, key_h)) key.name = white_key_names[i] self.white_keys.append(key) for i in range(len(black_key_names)): pos = black_positions[i] key = Key(Rect(0, pos * key_h + 10, key_w * 0.6, key_h - 20)) key.name = black_key_names[i] key.color = Color(0, 0, 0) key.highlight_color = Color(0.2, 0.2, 0.2) self.black_keys.append(key) def draw(self): stroke_weight(1) stroke(0.5, 0.5, 0.5) for key in chain(self.white_keys, self.black_keys): if key.touch is not None: fill(*key.highlight_color.as_tuple()) else: fill(*key.color.as_tuple()) rect(*key.frame.as_tuple()) def touch_began(self, touch): for key in chain(self.black_keys, self.white_keys): if key.hit_test(touch): key.touch = touch sound.play_effect(key.name) return def touch_moved(self, touch): hit_key = None for key in chain(self.black_keys, self.white_keys): hit = key.hit_test(touch) if hit and hit_key is None: hit_key = key if key.touch is None: key.touch = touch sound.play_effect(key.name) if key.touch == touch and key is not hit_key: key.touch = None def touch_ended(self, touch): for key in chain(self.black_keys, self.white_keys): if key.touch == touch: key.touch = None run(Piano(), PORTRAIT)
Append the Piano till G4
-
PeterG
Yes PeterG and PKHG are the same. Asking as PKHG for the forgotton password did not work 2-3 times, therfore a new account...
-
PeterG
Yes you are right , so the game starts now 😉
Eg can ask for a Name, BUT then there is nothing to go back to somewhere, have to reboot Ipad
self.game_state is not defined ERRORSame, can activate picture choice see a lot of possibilities BUT NO further action possible?!?!???
-
PeterG
Thanks ,
Stupid Peter, was not aware that searching if contents like site-packages are visible I can search for the directory and tap there on the zip file , etc, in stash indeed the unzip -t zipfilenamezip works very nice
Thanks helping a again Pyhonista user (first uses several years ago and than not using it)
Peter -
PeterG
Thanks for ...
I have the latest source I think.
The game does not run , it stops al the line trying to run ui- menu
And I have yet no idea where ui-menu comes from , where it has to be found, with what source content .. -
PeterG
Who is willing to help understanding the code, to add more working buttons?