• Because it has way to much errors with out from the last thread where I got the last Code that can take pictures of text and numbers either from your library or a disposable picture with the camera but I get way to much errors

  • @sodoku see also this topic

  • The reversed pop pop solution...

    def two_chars(a): s = list(reversed("".join(a))) while s: yield "".join((s.pop(), s.pop())) print(list(two_chars(a)))
  • @cvp So could ? this be an alternative for scene selecting ,as opposed to presenting scene and dismissing scene

  • The trick with .pyui files is that they are actually .json files so if you rename filename.pyui to filename.json then you can see the contents and post it to this forum or GitHub. Just make sure to change the name back before you run your program.

    When you post Python code to this forum, you can make it format nicely by wrapping in three backticks:
    ```python
    my Python code...
    ```

    And when you post pyui data, you can:
    ```yaml
    my pyui data...
    ```

  • @sodoku still dirt and unprofessional, but works for one undo/redo cross pages, but not for successive undo/redo

    from scene import * import ui #import time import scene import console gen_evol = [] gen_current_evol = 0 class MainMenuScene (Scene): def setup(self): self.background = SpriteNode(color = 'blue') self.background.size = self.size self.background.position = self.size / 2 self.add_child(self.background) self.page1=LabelNode('page1') self.page1.size=(75,75) self.page1.position=(44,860) self.add_child(self.page1) self.page2=LabelNode('page2') self.page2.size=(75,75) self.page2.position=(44,760) self.add_child(self.page2) def touch_began(self, touch): if self.page1.frame.contains_point(touch.location): self.present_modal_scene(a_scene) for child1 in a_scene.children: if len(child1.children) > 0: if isinstance(child1.children[0], LabelNode): lvl = child1.children[0].text for child2 in b_scene.children: if len(child2.children) > 0: if isinstance(child2.children[0], LabelNode): if child2.children[0].text == lvl: child1.text = child2.text elif self.page2.frame.contains_point(touch.location): self.present_modal_scene(b_scene) for child1 in b_scene.children: if len(child1.children) > 0: if isinstance(child1.children[0], LabelNode): lvl = child1.children[0].text for child2 in a_scene.children: if len(child2.children) > 0: if isinstance(child2.children[0], LabelNode): if child2.children[0].text == lvl: child1.text = child2.text #class Game (Scene): class AScene (Scene): def setup(self): global gen_evol,gen_current_evol self.background = SpriteNode(color = 'red') self.background.size = self.size self.background.position = self.size / 2 self.add_child(self.background) self.main=LabelNode('main') self.main.size=(75,75) self.main.position=(44,860) self.add_child(self.main) self.background_color = '#004f82' ground = Node(parent=self) x = 0 while x <= self.size.w + 64: tile = SpriteNode('plf:Ground_PlanetHalf_mid', position=(x, 0)) ground.add_child(tile) x += 64 self.player = SpriteNode('plf:AlienGreen_front') self.player.anchor_point = (0.5, 0) self.player.position = (self.size.w/2, 32) self.add_child(self.player) #Labels gen_evol = [] self.cards = [] y = 760 evol = [] for l in ['Level 1','Level 2','Level 1','Game Over']: card = LabelNode(' ')#,color=('#0016ff')) card.font = ('Menlo',60) card.position = (300,y) card.size = (160,100) self.add_child(card) card_name = LabelNode(l) card_name.font = card.font card_name.size = card.size card.add_child(card_name) self.cards.append(card) evol.append((l,card.text)) y = y - 100 gen_evol.append(evol) gen_current_evol = 0 #pause symbol self.pause_button = SpriteNode('iow:pause_32', position=(32, self.size.h-32), parent=self) #undo symbol self.undo_button = SpriteNode('iow:reply_256', position=(90, self.size.h-31), parent=self) self.undo_button.size = (50,50) #redo symbol self.redo_button = SpriteNode('iow:refresh_24', position=(160, self.size.h-31), parent=self) self.redo_button.size = (50,50) #control pause symbol button def touch_ended(self, touch): global gen_evol,gen_current_evol if self.pause_button.frame.contains_point(touch.location): self.v = ui.load_view('pawz.pyui') self.v['button1'].action = self.pawz_button_action self.v.present('sheet') self.v['textfield1'].begin_editing() elif self.undo_button.frame.contains_point(touch.location): if gen_current_evol > 0: gen_current_evol -= 1 evol = gen_evol[gen_current_evol] #print('undo',gen_current_evol,evol) for e in evol: txt = e[0] for card in self.cards: if card.children[0].text == txt: card.text = e[1] elif self.redo_button.frame.contains_point(touch.location): if gen_current_evol < (len(gen_evol)-1): gen_current_evol += 1 evol = gen_evol[gen_current_evol] #print('redo',gen_current_evol,evol) for e in evol: txt = e[0] for card in self.cards: if card.children[0].text == txt: card.text = e[1] def pawz_button_action(self,sender): global gen_evol,gen_current_evol # pause button txt = self.v['textfield1'].text evol = [] for card in self.cards: if card.children[0].text == txt: card.text = '😀' #else: #card.text = ' ' evol.append((card.children[0].text,card.text)) gen_evol.append(evol) gen_current_evol = len(gen_evol) - 1 self.v.close() def touch_began(self, touch): if self.main.frame.contains_point(touch.location): self.dismiss_modal_scene() class BScene (Scene): def setup(self): global gen_evol,gen_current_evol self.background = SpriteNode(color = '#71edff') self.background.size = self.size self.background.position = self.size / 2 self.add_child(self.background) self.main=LabelNode('main') self.main.size=(75,75) self.main.position=(44,760) self.add_child(self.main) self.background_color = '#004f82' ground = Node(parent=self) x = 0 while x <= self.size.w + 64: tile = SpriteNode('plf:Ground_PlanetHalf_mid', position=(x, 0)) ground.add_child(tile) x += 64 self.player = SpriteNode('plf:AlienGreen_front') self.player.anchor_point = (0.5, 0) self.player.position = (self.size.w/2, 32) self.add_child(self.player) #Labels gen_evol = [] self.cards = [] y = 760 evol = [] for l in ['Level 1','Level 2','Level 1','Game Over']: card = LabelNode(' ')#,color=('#0016ff')) card.font = ('Menlo',60) card.position = (300,y) card.size = (160,100) self.add_child(card) card_name = LabelNode(l) card_name.font = card.font card_name.size = card.size card.add_child(card_name) self.cards.append(card) evol.append((l,card.text)) y = y - 100 gen_evol.append(evol) gen_current_evol = 0 #pause symbol self.pause_button = SpriteNode('iow:pause_32', position=(32, self.size.h-32), parent=self) #undo symbol self.undo_button = SpriteNode('iow:reply_256', position=(90, self.size.h-31), parent=self) self.undo_button.size = (50,50) #redo symbol self.redo_button = SpriteNode('iow:refresh_24', position=(160, self.size.h-31), parent=self) self.redo_button.size = (50,50) #control pause symbol button def touch_ended(self, touch): global gen_evol,gen_current_evol if self.pause_button.frame.contains_point(touch.location): self.v = ui.load_view('pawz.pyui') self.v['button1'].action = self.pawz_button_action self.v.present('sheet') self.v['textfield1'].begin_editing() elif self.undo_button.frame.contains_point(touch.location): if gen_current_evol > 0: gen_current_evol -= 1 evol = gen_evol[gen_current_evol] #print('undo',gen_current_evol,evol) for e in evol: txt = e[0] for card in self.cards: if card.children[0].text == txt: card.text = e[1] elif self.redo_button.frame.contains_point(touch.location): if gen_current_evol < (len(gen_evol)-1): gen_current_evol += 1 evol = gen_evol[gen_current_evol] #print('redo',gen_current_evol,evol) for e in evol: txt = e[0] for card in self.cards: if card.children[0].text == txt: card.text = e[1] def pawz_button_action(self,sender): global gen_evol,gen_current_evol # pause button txt = self.v['textfield1'].text evol = [] for card in self.cards: if card.children[0].text == txt: card.text = '😀' #else: #card.text = ' ' evol.append((card.children[0].text,card.text)) gen_evol.append(evol) gen_current_evol = len(gen_evol) - 1 self.v.close() def touch_began(self, touch): if self.main.frame.contains_point(touch.location): self.dismiss_modal_scene() main_menu_scene = MainMenuScene() a_scene = AScene() b_scene = BScene() main_view = ui.View() scene_view = SceneView(frame=main_view.bounds, flex='WH') main_view.add_subview(scene_view) scene_view.scene = main_menu_scene main_view.present(hide_title_bar=True, animated=False)
  • @sodoku try this

    from scene import * class Game (Scene): def setup(self): self.background_color = '#004f82' ground = Node(parent=self) x = 0 while x <= self.size.w + 64: tile = SpriteNode('plf:Ground_PlanetHalf_mid', position=(x, 0)) ground.add_child(tile) x += 64 self.player = SpriteNode('plf:AlienGreen_front') self.player.anchor_point = (0.5, 0) self.player.position = (self.size.w/2, 32) self.add_child(self.player) #Label 1 self.card = LabelNode('',color=('#0016ff')) #self.card = LabelNode((text[0]),color=('#0016ff')) self.card.position = (85,760) self.add_child(self.card) self.card.size = (100,100) #pause symbol self.pause_button = SpriteNode('iow:pause_32', position=(32, self.size.h-32), parent=self) #control pause symbol button def touch_ended(self, touch): if self.pause_button.frame.contains_point(touch.location): self.v = ui.load_view('pawz.pyui') self.v['button1'].action = self.pawz_button_action self.v.present('sheet') self.v['textfield1'].begin_editing() def pawz_button_action(self,sender): self.card.text = self.v['textfield1'].text self.v.close() if __name__ == '__main__': run(Game(), PORTRAIT, show_fps=True)
  • @sodoku Believe me, my knowledge of Python is not so big as you think. Often, this kind of code is more a problem of logic, not of programming language. And, my age has the only advantage of giving a longer experience. 😀 but also 😢

Internal error.

Oops! Looks like something went wrong!