@dgelessus Thanks for being so thorough in your answer. I'd read somewhere that source code is often split between various languages and compiled differently, but your answer has cleared up a few things for me. That
scene.pyfile is also interesting to look at; thanks for pointing me to it :)
@enceladus Thanks for the in-depth reply! I quite like the custom_action implementation, I'm just playing around with it now and wondered if it was possible to add parameters to the custom actions. I can get a custom action to function if it takes no parameters, but I'm struggling with ones that do take parameters.
As an example, I have a function which rotates one object around another by a specified amount of degrees:
def rotate_around(self, point, centre, angle): p = point.position #point c = centre.position #centre a = ((angle)*(math.pi/180)) #angle x = math.cos(a)*(p.x-c.x)-math.sin(a)*(p.y-c.y)+c.x y = math.sin(a)*(p.x-c.x)+math.cos(a)*(p.y-c.y)+c.y point.position = (x,y)
How would I go about translating this into a custom action so that it could be used in a sequence or group etc?
Again, thanks for the help! :)
Thanks for taking the time to reply. Sadly, I don't think I've worded myself very well so I'll try specifying a bit more carefully.
In the Scene module, there are Action objects with methods such as "move_to" and "rotate_by", I'd like to be able to view the code that defines these built-in methods so I can get a better understanding of them.
So I'm assuming there's code somewhere within the app under the Action class that includes a function definition beginning "def move_to(x, y[, duration, timing_mode])" and containing the code which is executed when this method is called.
I might have my assumptions wrong, or this code might be inaccessible to view, so apologies if I'm asking a silly question. Viewing the definitions for built-in methods would just be quite convenient for me, as a learner, to better understand how things work.
I've been using Pythonista for about a week now; primarily as a learning tool while I'm on the go. With that in mind, my terminology might be a little off so I apologise if I sound like I have no idea what I'm talking about.
Basically, I've been playing around with making little 2D games with the app and I want to delve into some of the functions a bit more. I was hoping to be able to see some of the definitions for functions so I can get a glimpse of how they perform. I'd also like to implement my own action functions similar to "move_to" and "rotate_by".
Is it possible to view these definitions somewhere? Either within the app or online etc. I believe Visual Studio allows you to highlight a function call and right-click to view its definition but I'm struggling to find anything similar in Pythonista.
Any help would be much appreciated! :)