omz:forum

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

    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 29
    • Posts 275
    • Best 42
    • Controversial 0
    • Groups 0

    brumm

    @brumm

    49
    Reputation
    3082
    Profile views
    275
    Posts
    2
    Followers
    0
    Following
    Joined Last Online
    Website github.com/humberry Location Europe

    brumm Unfollow Follow

    Best posts made by brumm

    • [Share Code] Unzipper

      Unzipper (required File Picker) 😀

      posted in Pythonista
      brumm
      brumm
    • RE: Ideas???

      I‘ve just updated my Three-Cloumn-Sortable-TableView-Example. Maybe some parts are useful.

      posted in Pythonista
      brumm
      brumm
    • RE: Editing text in games

      You might want to check the TextView. There is also a post about “search and selecting“ in this forum (i saw it a while ago).

      select

      posted in Pythonista
      brumm
      brumm
    • [Share Code] DrawOnImage

      DrawOnImage

      Updated.

      posted in Pythonista
      brumm
      brumm
    • RE: Help with Menu/window for Pythonista..

      I think you miss a column!? 1256x792

      posted in Pythonista
      brumm
      brumm
    • RE: Open page source in Pythonista

      line28 = getDocPath

      posted in Pythonista
      brumm
      brumm
    • RE: Wolfenstein-like Raycasting renderer

      Great, thank you for sharing. Maybe you like to import motion?

      # RayCast
      # Simple raycasting based renderer
      # Touch the left part to rotate, and touch the right part to move forward
      # Coded in a few hours during my holidays, July 2014, straight from my iPhone - thanks Pythonista !!!
      # Feel free to upgrade !
      # Enjoy !
      # Emmanuel ICART
      # eicart@momorprods.com
      
      from scene import *
      from math import *
      import motion
      
      # rendering step - 1=best(slower)
      RENDERING_STEP=2
      
      # level data
      # 1 = wall, 0 = empty
      level = [[1,1,1,1,1,1,1,1],
               [1,1,0,0,0,0,0,1],
               [1,0,0,0,0,1,0,1],
               [1,0,1,0,0,0,0,1],
               [1,1,0,0,0,1,0,1],
               [1,0,0,1,1,0,0,1],
               [1,0,0,0,0,0,0,1],
               [1,1,1,1,1,1,1,1]]         
      LX=len(level[0])
      LZ=len(level)
      
      CellSize=128
      scan=10
      
      
      # player
      xo=CellSize*LX/2
      zo=CellSize*LZ/2
      angle=45.0
      fov=80
      
      class RayCastScene (Scene):
      	def setup(self):
      		motion.start_updates()
      		# preload the texture
      		self.texture='PC_Chest_Closed'
      		self.screenWidth=int(self.size.w)
      		self.screenHeight=int(self.size.h)
      		self.xTouchStart, self.yTouchStart, self.zTouchStart = motion.get_gravity()
      		load_image(self.texture)
      		
      	
      	def draw(self):
      		global angle
      		global xo
      		global zo
      		# This will be called for every frame (typically 60 times per second).
      		
      		# clear background 
      		background(0, 0, 0)
      
      		focale=0.5*self.screenWidth/tan(radians(fov/2))
      		
      		# compute each screen column
      		for column in xrange(0,self.screenWidth,RENDERING_STEP):
      			scan_angle=angle+((float(column)-self.screenWidth/2)*fov)/self.screenWidth
      			c=cos(radians(scan_angle))
      			s=sin(radians(scan_angle))
      			if abs(c)<0.001:
      				if c>0:
      					c=0.001
      				else:
      					c=-0.001
      				
      			if abs(s)<0.001:
      				if s>0:
      					s=0.001
      				else:
      					s=-0.001
      				
      			t2=s/c
      			t1=c/s
      			ok1=True
      			ok2=True
      				
      			#Initialization of ray casting
      			pz1=t2*CellSize
      			if c>0:
      				px1=CellSize
      				ini=0
      			else:
      				px1=-CellSize
      				pz1=-pz1
      				ini=CellSize-1
      				
      			xp1=ini+(((int)(xo/CellSize))*CellSize)
      			zp1=zo+((xp1-xo)*pz1)/px1
      				
      			px2=t1*CellSize
      			if s>0:
      				pz2=CellSize
      				ini=0
      			else:
      				pz2=-CellSize
      				px2=-px2
      				ini=CellSize-1
      				
      			zp2=ini+(((int)(zo/CellSize))*CellSize)
      			xp2=xo+((zp2-zo)*px2)/pz2
      			
      			#****** cast a ray for z walls ******
      			compteur=0
      			while True:
      				xp1+=px1
      				zp1+=pz1
      				compteur+=1
      				xd=(int)(xp1/CellSize) % LX
      				zd=(int)(zp1/CellSize) % LZ
      				if (xd<0): xd=0
      				if (zd<0): zd=0
      				
      				if level[xd][zd]!=0 or compteur>=scan: break
      			
      			if (compteur==scan):ok1=False
      			distance1=(xp1-xo)/c
      			col1=(zp1 % CellSize)
      			if (px1<=0): col1=CellSize-1-col1
      			
      			#****** cast a ray for x walls ****** 
      			compteur=0
      			while True:
      				xp2+=px2
      				zp2+=pz2
      				compteur+=1
      				xd=(int)(xp2/CellSize) % LX
      				zd=(int)(zp2/CellSize) % LZ
      				if (xd<0):xd=0
      				if (zd<0):zd=0
      				if level[xd][zd]!=0 or compteur>=scan: break
      			
      			if (compteur==scan): ok2=False
      			distance2=(zp2-zo)/s
      			col2=(xp2 % CellSize)
      			if (pz2>=0):col2=CellSize-1-col2
      			
      			#Choose the nearest wall (x or z)
      			if (distance1<distance2):
      				distance=1+(distance1)
      				colonne=col1
      			else:
      				distance=1+(distance2)
      				colonne=col2
      			
      			if ok1 or ok2:
      				# fix the fishbowl effect
      				distance=distance*cos(radians(angle-scan_angle))
      				
      				#compute the wall screen height
      				hauteur = ((CellSize*focale)/distance)
      
      			# draw the column
      			ximage=(colonne*128)/CellSize # 101 x 171 tile
      			image(self.texture,column,(self.screenHeight-hauteur)/2,RENDERING_STEP,hauteur,ximage,0,RENDERING_STEP,171)
      
      			# rotation/displacement control
      			x,y,z = motion.get_gravity()
      			angle += 0.01*(y-self.yTouchStart)
      			speed=(self.xTouchStart-x)*0.05
      			dx=speed*cos(radians(angle))
      			dz=speed*sin(radians(angle))
      			if level[int((xo+dx)/CellSize)][int(zo/CellSize)]!=0:dx=0
      			if level[int(xo/CellSize)][int((zo+dz)/CellSize)]!=0:dz=0
      			xo+=dx
      			zo+=dz
      	
      	def touch_began(self, touch):
      		pass
      	
      	def touch_moved(self, touch):
      		pass
      
      	def touch_ended(self, touch):
      		pass
      
      run(RayCastScene(),LANDSCAPE)
      
      posted in Pythonista
      brumm
      brumm
    • RE: Show hidden files

      PhoneManager

      posted in Pythonista
      brumm
      brumm
    • RE: Can you make a ui.Button.action repeat when the button is held?

      You can make your own Button/View and use the methods touch_began(), touch_ended() and a timer. example You maybe also need @ui.in_background.

      posted in Pythonista
      brumm
      brumm
    • RE: Change Keyboard Layout/Language

      MyVocabTrainer

      Far away from being finished. Ugly code and only for fixed iPad 768x1024 resolution.

      posted in Pythonista
      brumm
      brumm

    Latest posts made by brumm

    • RE: Trying to change label.text

      Here you can find the manual for the ui module and a tutorial.

      posted in Pythonista
      brumm
      brumm
    • RE: Looking for a guide on how to integrate Pythonista and Working Copy, to use Git/GitHub inside Pythonista

      Not sure if you want to know the basics.

      1. Clone repository with working copy
      2. Open pythonista and go to external files > open...
      3. Choose the repository directory under working copy
        As soon as you add a file there, you can commit it in working copy.

      If you struggle with 1., there is a user guide in the working copy settings section.

      posted in Pythonista
      brumm
      brumm
    • RE: Create beautiful abstract paintings with this script. Free for all on github.

      Reminds me to my old lava lamp.

      posted in Pythonista
      brumm
      brumm
    • RE: Show hidden files

      PhoneManager

      posted in Pythonista
      brumm
      brumm
    • RE: Can you make a ui.Button.action repeat when the button is held?

      You can make your own Button/View and use the methods touch_began(), touch_ended() and a timer. example You maybe also need @ui.in_background.

      posted in Pythonista
      brumm
      brumm
    • RE: Ideas???

      I‘ve just updated my Three-Cloumn-Sortable-TableView-Example. Maybe some parts are useful.

      posted in Pythonista
      brumm
      brumm
    • Vocabulary Trainer

      MyVocabTrainer has reached a beta phase. If there is no need for a second keyboard layout, you can easily comment line 466 # russian_keyboard.SetTextFieldPad(self.view['textfield2']) # out. The database structure you can find in the lines 210 to 230. The Import/Export section is not ready yet, stay tuned.

      posted in Pythonista
      brumm
      brumm
    • RE: Change Keyboard Layout/Language

      MyVocabTrainer

      Far away from being finished. Ugly code and only for fixed iPad 768x1024 resolution.

      posted in Pythonista
      brumm
      brumm
    • RE: Change Keyboard Layout/Language

      Wow! Thank you so much. Looks awesome.
      @cvp Btw. would it be okay for you, if I upload my VocabularyTrainer with your code to Github? Or can I put a link to your gist in my future repository?

      posted in Pythonista
      brumm
      brumm
    • RE: Home Screen Apps Error: File Not Found

      Same here. Workaround -> you can use Shortcuts > run pythonista > /path/script.py > share > homescreen

      posted in Pythonista
      brumm
      brumm