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.
Help! I need help thinking of python projects I can do.
-
@stephen
Have you ever seen, like, those super simple block-programming apps? That they use to semi-teach people to program? -
I am trying to make my own block-programming thingy, but I don’t know how to create the blocks, make them movable, or even make them connect together.
-
Like minecraft/terreria?
-
You mean like moving the items in the inventories?
If so, yes, that is kinda what I mean. -
from scene import * def Dirt(parent, pos, size=(64, 64)): sn=SpriteNode( texture=Texture('plf:Ground_GrassCenter'), parent=parent, anchor_point=(0.0, 0.0), size=size, position=pos) return sn def Stone(parent, pos, size=(64, 64)): sn=SpriteNode( texture=Texture('plf:Ground_DirtCenter'), parent=parent, anchor_point=(0.0, 0.0), size=size, position=pos) return sn def fixed_position(x, fixed_val=64): return x - x%fixed_val class MyScene(Scene): def setup(self): self.active_block=None self.anchor_point=(0.0, 0.0), self.dirt_button=Dirt(self, (self.size[0]/2-80, self.size[1]-196)) self.stone_button=Stone(self, (self.size[0]/2+80, self.size[1]-196)) def touch_began(self, touch): if touch.location in self.dirt_button.frame: self.active_block=Dirt(self, touch.location) if touch.location in self.stone_button.frame: self.active_block=Stone(self, touch.location) def touch_moved(self, touch): if self.active_block: self.active_block.position=touch.location def touch_ended(self, touch): x, y = self.active_block.position self.active_block.position=(fixed_position(x), fixed_position(y)) self.active_block=None run(MyScene())
-
Thank you! I would not have been able to figure that out on my own.
-
@stephen
Also, is there any way to set my own sprite/look for the objects? Like, make the dirt one look however I want it to? -
texture=Texture('plf:Ground_DirtCenter')
is what sets the look. Other textures (images) are available to you as discussed in the Pythonista docsYou can access built-in images in Pythonista using the [+] button at the top of the editor.
-
@Bumbo-Cactoni said:
Thank you! I would not have been able to figure that out on my own.
no problem 😎 and im sure you would of got the hang of it. its only intimidating at first then once you get a couple projects done it goes smoothly.
@Bumbo-Cactoni said:
@stephen
Also, is there any way to set my own sprite/look for the objects? Like, make the dirt one look however I want it to?just create a
png
jpg
ortiff
image, then import it and inside Texture() pass the string path or ui.Image for the one you made. keep in mind the balance of filesize to quality. and resizing if your going to use multiple coppies you want to change scale instead of size.freindly tip:
Use a dict to cache your Texture for performance.
class MyScene(Scene): def setup(self): self.cache={"dirt":Texture('path/img1.png', "stone":Texture('path/img2.png'} def Dirt(self): node=SpriteNode( texture=self.cache['dirt'], parent=parent, anchor_point=(0.0, 0.0), size=size, position=pos) return node
instead of creating a new Texture each time
-
@Bumbo-Cactoni I'm a bit late to the party, but you could always check out Cambidge IGCSE Computer Science past papers. Just search for them in your favourite search engine. They provide beginner level excercises and solutions, since the exams are aimed at students with 2 years of coding experience.
Just be aware that for every year, there's one paper with a coding excercise (the one you want) and one paper with theory (boring).I had to pass this exam in 2018, just as an example
There's more here. -
Thank you
-
@Bumbo-Cactoni
Can you think of something useful that you would use often? Even if it’s an app that you already have, you could write a clone from scratch. My first Python app will be an app that helps me with my small business (tracking and logging actions taken and status of individual jobs). It will automate/streamline a lot of the day-to-day stuff I do repetitively, help me stay organized, and prevent things from “slipping through the cracks”. I’m in the beginning phase, outlining the workflow and functionality. Once that’s done, I’ll do some screen mockups. Then...Pythonista time! -
@donnybahama
I have found something to set my mind on, which will actually be quite useful when finished. My 17 year-old brother has a self-run business where he uses his pickup to haul off people’s yard and house junk. I am currently designing a sort of calendar for him to schedule jobs. I know he could just use the calendar app, but I needed something to do. Anyways, I could also use some help with the scene module, as there are no instructions online, due to it being a pythonista-exclusive module. -
@Bumbo-Cactoni, sounds like a cool project. I have yet to see a really good touch and visualization-friendly scheduling app on iOS.
For something like this, I would strongly recommend using the ui module instead of scene. On top of a
feeling based on years of using Pythonista, I base this recommendation on some real arguments:- scene is meant for games.
- ui has built-in support for element level touch management and supporting stuff for e.g. gestures.
- ui is based on native iOS components in a way that is pretty well understood here. This means that if something does not work the way you want, it can most often be fixed or expanded with
objc_util
. - I think you can tap into a broader set of experience in the forum.
-
@mikael
Thanks for the suggestion! Also, do you happen to know how to use the ui module well? Just like scene, there are no tutorials online for me to follow. -
@Bumbo-Cactoni, maybe, if you describe in broad terms what you want to make happen, we can start from there.
-
See
ui-tutorial
at https://github.com/Pythonista-Tools/Pythonista-Tools/blob/master/UI.md -