omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular
    1. Home
    2. PeterG

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    • Profile
    • Following 0
    • Followers 2
    • Topics 3
    • Posts 13
    • Best 2
    • Controversial 0
    • Groups 0

    PeterG

    @PeterG

    Python Notebook

    2
    Reputation
    1134
    Profile views
    13
    Posts
    2
    Followers
    0
    Following
    Joined Last Online
    Location Enschede, Niederlande Age 81

    PeterG Unfollow Follow

    Best posts made by PeterG

    • RE: using zipfile is a problem for me

      Yes PeterG and PKHG are the same. Asking as PKHG for the forgotton password did not work 2-3 times, therfore a new account...

      posted in Pythonista
      PeterG
      PeterG
    • Turtle graphics

      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 ...)

      posted in Editorial
      PeterG
      PeterG

    Latest posts made by PeterG

    • Turtle graphics

      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 ...)

      posted in Editorial
      PeterG
      PeterG
    • RE: No multiplicatio star on new ipytn mini with pythonista 3

      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

      posted in Pythonista
      PeterG
      PeterG
    • No multiplicatio star on new ipytn mini with pythonista 3

      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 ...

      posted in Pythonista
      PeterG
      PeterG
    • website alife?

      In the overview all posts are 5 years old,
      No users anymore?

      posted in Editorial
      PeterG
      PeterG
    • RE: Scene transitions

      @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

      posted in Pythonista
      PeterG
      PeterG
    • RE: Simple UI tutorial?

      @ccc very nice example.
      What and why flex=name ? Can't find the meaning of it

      posted in Pythonista
      PeterG
      PeterG
    • RE: problems trying a game

      @ccc THAT was the real timesaver, thanks a lot 😉

      posted in Pythonista
      PeterG
      PeterG
    • RE: more notes in piano
      #! 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

      posted in Pythonista
      PeterG
      PeterG
    • RE: using zipfile is a problem for me

      Yes PeterG and PKHG are the same. Asking as PKHG for the forgotton password did not work 2-3 times, therfore a new account...

      posted in Pythonista
      PeterG
      PeterG
    • RE: problems trying a game

      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 ERROR

      Same, can activate picture choice see a lot of possibilities BUT NO further action possible?!?!???

      posted in Pythonista
      PeterG
      PeterG