omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular
    1. Home
    2. david
    3. Posts

    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 7
    • Followers 0
    • Topics 7
    • Posts 19
    • Best 3
    • Controversial 0
    • Groups 0

    Posts made by david

    • RE: Pythonista is now featured on Python.org

      Great new.... Congrats!

      posted in Pythonista
      david
      david
    • RE: Video preview inside ui.view [beta]

      Hi, a doubt...
      you can put (overlap) buttons and or lines on top or the camera view?
      for example, draw a "transparent" grid...

      posted in Pythonista
      david
      david
    • RE: Change background color in the dialogs form?

      working on it... thank you!

      posted in Pythonista
      david
      david
    • Change background color in the dialogs form?

      Hi,
      can it be changed the background color in the dialogs form?

      Best regards.

      posted in Pythonista
      david
      david
    • Access to App Store data?

      Hi all,

      is there some code in python so that I can read data from my account of the App Store, for example, my purchased apps that are not installed on the iPad, or saved apps on the wish list?

      Cheers

      posted in Pythonista
      david
      david
    • RE: A full book of Pythonista?

      Great idea, Javier

      posted in Pythonista
      david
      david
    • RE: How do I do to play the movements registered in the scene?

      Any idea?... :)

      posted in Pythonista
      david
      david
    • RE: How do I do to play the movements registered in the scene?

      Hi, thank you ccc...

      my intention was to circle to scour the home path to end, but no wake, i.e. see the circle in motion following the route drawn.

      Cheers,
      David

      posted in Pythonista
      david
      david
    • RE: A full book of Pythonista?

      A PDF/epub would be sufficient, without necessity (nor to make the expense) of publishing it in paper ...

      posted in Pythonista
      david
      david
    • A full book of Pythonista?

      Hi,
      Without a doubt I would buy a book about Pythonista, dedicated mainly to the "scene" and "ui" with many examples. Does anyone support this idea?

      Yes, the idea is aimed at OMZ :)

      Cheers

      posted in Pythonista
      david
      david
    • How do I do to play the movements registered in the scene?

      Hi all,
      After recording the movement of the finger on the screen... How do I do to play the movements registered in the scene?

      Cheers

      My (naive) code:

      import scene
      
      # for recording x and y...
      pointX = []
      pointY = []
      
      class MyScene(scene.Scene):
      	def __init__(self, in_dot_color=scene.Color(0, 0, 0, 1)):
      		super().__init__()
      		self.dot_color = in_dot_color
      		self.touch = None
      		
      	def draw(self):
      		scene.background(0, 0, 0)
      		if self.touch:
      			scene.fill('red')
      			x, y = self.touch.location
      			scene.ellipse(x - 50, y - 50, 100, 100)
      			scene.text(str(x) + ', ' + str(y), 'Futura', 20, 100, 50)
      			pointX.append(x)
      			pointY.append(y)
      			
      	def touch_began(self, touch):
      		pointX.clear()
      		pointY.clear()
      		self.touch = touch
      		
      	def touch_moved(self, touch):
      		self.touch = touch
      		
      	def touch_ended(self, touch):
      		self.touch = None
      
      		
      scene.run(MyScene(), show_fps=True)
      
      posted in Pythonista
      david
      david
    • RE: App template for iOS and small console-based game?

      Hi all,

      The intention was to use the docopt package, but being so, I am assuming that I need to do a specific UI. The mini game aims to emulate a system admin terminal.

      The case is that I will need a virtual keyboard (do I have to do it or is there any available in/for pythonista?)

      Cheers,
      David

      posted in Pythonista
      david
      david
    • App template for iOS and small console-based game?

      Hi all,
      can I use the template to generate an App for iOS if I developed a small console-based game? how it will be the interface of the user in that case?

      Best regards.

      Note: currently do not have a Mac (Intel) to test.

      posted in Pythonista
      david
      david
    • RE: Colorama, see characters in color?

      Hi, Many thanks to all. I will follow these indications.
      I believe that they are sufficient for now.

      posted in Pythonista
      david
      david
    • RE: Colorama, see characters in color?

      Hi, then, this not what can I do?...

      https://github.com/tartley/colorama/raw/master/screenshots/ubuntu-demo.png

      posted in Pythonista
      david
      david
    • Colorama, see characters in color?

      Hi al,
      I have installed the package colorama but it seems that the console color characters are not displayed.

      Minimal sample:

      from colorama import Fore, Back, Style
      print(Fore.RED + 'some red text')
      print(Back.GREEN + 'and with a green background')
      print(Style.DIM + 'and in dim text')
      print(Style.RESET_ALL)
      print('back to normal now')
      

      Output:

      some red text
      and with a green background
      and in dim text
      
      back to normal now
      

      Does it alternative?
      Best, David

      posted in Pythonista
      david
      david
    • RE: Where is the bug?... in .update(self.dt)

      Nice. This work. Thank you!

      posted in Pythonista
      david
      david
    • RE: Where is the bug?... in .update(self.dt)

      Hi all... Yes, the "problem" appears in the line "253 value = Color()" in scene_drawing.py

      Following the line that says @ccc, I understand that I have to change the "classic rendering loop" by "Node/Action" ... any suggestions?

      posted in Pythonista
      david
      david
    • Where is the bug?... in .update(self.dt)

      Hello everyone.

      I'm trying to adapt the card game shown below to the Pythonista 3, but I find a bug that I am unable to resolve. It appears in the "draw" function and the error is "init() missing 4 required positional arguments: r, g, b, a,...". Some clue?

      Best regards

      # Card Game
      #
      # In this game, you have to find matching pairs of cards.
      # This scene consists entirely of layers and demonstrates some
      # interesting animation techniques.
      
      from scene import *
      from random import shuffle
      from functools import partial
      import sound
      
      class Game(Scene):
      	def setup(self):
      		self.root_layer = Layer(self.bounds)
      		for effect in ['Click_1', 'Click_2', 'Coin_2', 'Coin_5']:
      			sound.load_effect(effect)
      			
      		self.deal()
      		
      	def draw(self):
      		background(0.0, 0.2, 0.3)
      		self.root_layer.update(self.dt)  ### bug???
      		self.root_layer.draw()
      		
      	def deal(self):
      		images = ['Rabbit_Face', 'Mouse_Face', 'Cat_Face',
      		'Dog_Face', 'Octopus', 'Bear_Face',
      		'Chicken', 'Cow_Face'] * 2
      		for image in images:
      			load_image(image)
      		shuffle(images)
      		self.root_layer.sublayers = []
      		self.cards = []
      		self.selected = []
      		card_size = 96 if self.size.w > 700 else 64
      		width = (card_size + 5) * 4
      		offset = Point((self.size.w - width)/2,
      		(self.size.h - width)/2)
      		for i in range(len(images)):
      			x, y = i % 4, i // 4
      			card = Layer(Rect(offset.x + x * (card_size + 5),
      			offset.y + y * (card_size + 5),
      			card_size, card_size))
      			card.card_image = images[i]
      			card.background = Color(0.9, 0.9, 0.9, 1)
      			card.stroke = Color(1, 1, 1, 1)
      			card.stroke_weight = 4.0
      			self.add_layer(card)
      			self.cards.append(card)
      		self.touch_disabled = False
      		
      	def touch_began(self, touch):
      		if self.touch_disabled or len(self.cards) == 0:
      			return
      		if len(self.selected) == 2:
      			self.discard_selection()
      			return
      		for card in self.cards:
      			if card in self.selected or len(self.selected) > 1:
      				continue
      			if touch.location in card.frame:
      				def reveal_card():
      					card.image = card.card_image
      					card.animate('scale_x', 1.0, 0.15,
      					completion=self.check_selection)
      				self.selected.append(card)
      				self.touch_disabled = True
      				card.animate('scale_x', 0.0, 0.15,
      				completion=reveal_card)
      				card.scale_y = 1.0
      				card.animate('scale_y', 0.9, 0.15, autoreverse=True)
      				sound.play_effect('Click_1')
      				break
      				
      	def discard_selection(self):
      		sound.play_effect('Click_2')
      		for card in self.selected:
      			def conceal(card):
      				card.image = None
      				card.animate('scale_x', 1.0, 0.15)
      			card.animate('scale_x', 0.0, 0.15,
      			completion=partial(conceal, card))
      			card.scale_y = 1.0
      			card.animate('scale_y', 0.9, 0.15, autoreverse=True)
      		self.selected = []
      		
      	def check_selection(self):
      		self.touch_disabled = False
      		if len(self.selected) == 2:
      			card_img1 = self.selected[0].card_image
      			card_img2 = self.selected[1].card_image
      			if card_img1 == card_img2:
      				sound.play_effect('Coin_5')
      				for c in self.selected:
      					c.animate('background', Color(0.5, 1, 0.5, 1))
      					self.cards.remove(c)
      					self.selected = []
      					if len(self.cards) == 0:
      						self.win()
      						
      	def new_game(self):
      		sound.play_effect('Coin_2')
      		self.deal()
      		self.root_layer.animate('scale_x', 1.0)
      		self.root_layer.animate('scale_y', 1.0)
      		
      	def win(self):
      		self.delay(0.5, partial(sound.play_effect, 'Powerup_2'))
      		font_size = 100 if self.size.w > 700 else 50
      		text_layer = TextLayer('Well Done!', 'Futura', font_size)
      		text_layer.frame.center(self.bounds.center())
      		overlay = Layer(self.bounds)
      		overlay.background = Color(0, 0, 0, 0)
      		overlay.add_layer(text_layer)
      		self.add_layer(overlay)
      		overlay.animate('background', Color(0.0, 0.2, 0.3, 0.7))
      		text_layer.animate('scale_x', 1.3, 0.3, autoreverse=True)
      		text_layer.animate('scale_y', 1.3, 0.3, autoreverse=True)
      		self.touch_disabled = True
      		self.root_layer.animate('scale_x', 0.0, delay=2.0,
      		curve=curve_ease_back_in)
      		self.root_layer.animate('scale_y', 0.0, delay=2.0,
      		curve=curve_ease_back_in,
      		completion=self.new_game)
      		
      run(Game())
      
      
      
      posted in Pythonista
      david
      david