I have putting this out way to long, and it has annoyed me for some time.
I want to hide the white cross when I run my coded flight sim panels on full screen.
The iPad general information bar would be nice to hide as well, but that is not an option from what I read.
But the Cross..... Is that possible in any way ?
Hi, The export function to xcode is not working at the moment. Will it be back in the next update ?
In the meantime. Is there a workflow to follow to manually get a script with images and txt files from Pythonista to the newest version of xcode ? Maybe downgrade xcode to an earlier version ?
Appreciate a little help
Best regards Peter
Edit: Sorry for posting this in the wrong forum section at first (Markdown forum)
The export function to xcode is not working at the moment.
Will it be back in the next update ?
In the meantime.
Is there a workflow to follow to manually get a script with images and txt files from Pythonista to the newest version of xcode ?
Maybe downgrade xcode to an earlier version ?
Appreciate a little help
Best regards Peter
To clarify why I wants to take a screenshot or draw into a context, please consider the following code
from scene import * from PIL import Image, ImageDraw class MyScene (Scene): def setup(self): img = Image.new("RGBA", (300,300)) draw = ImageDraw.Draw(img) draw.ellipse((0,0,200,200),fill=(255,255,255,255)) del draw self.imageName = load_pil_image(img) def draw(self): background(0.09,0.09,0.102) image(self.imageName,200,300,300,300) fill(1,1,1,1) no_stroke() ellipse(500,400,200,200) run(MyScene(), LANDSCAPE)
There is a clearly visible difference between the two circles.
What I am aiming for is to predefine a number of pictures in Setup and then use those in Draw.
The pictures are complicated and I think it would be to expencive to FPS to draw all the elements they contain (text, multiple lines, circles, gradients and so on) in every Draw loop.
An option would be to make the images by forehand but since the user will need to change details, this is not an option.
So I was thinking on setting up the whole 1024x768 backgrund picture in Setup and every time the user specifies changes.
Hope this clarifies a little ccc as a reply to you pm.
The thing I was looking for was a way to build a picture in the Scene Setup and then use this as a regular image later on in draw.
I know this can be done with a PIL image directly, but the drawing of especially circles and arcs has no anti aliasing and therefore looks ugly.
So my idea was to build the whole image from drawing elements and then screen shot it to an image. The app would blink at startup, I think, but that is not a problem.
Building the image before run is not an option since there will be changes from time to time when the app is launched.
I have this code but it seems impossible for me to save the function to a variable with parameters and call it later on.
from scene import *
class MyScene (Scene):
self.a = test(200,200)
def draw(self): background(0, 0, 0) test(100,100) #how do I call self.a with its parameters
Test(100,100) works fine !
Though Pythonista has the best editor I have come across, it is still best to work on a computer when writing many code lines and extensive editing.
So I export to X-Code in the beginning of a project and build to iPad or Simulator
Question is if it is necessary to think ahead and make sure that all fonts, images and sounds has been included before exporting ?
I am new here coming from Codea.
There are no access to an udp stream in Codea but looks like it is possible in Pytonista.
Does anyone have an example to start out with ?
I see the snipperts in the documentation, but from previous experience with Python, I know that some kind of threading is needed, so any help to get started is appreciated.
Hi, My name is Peter and also a granddad 54 years old ;-)
My profession is wind turbine construction as an independent construction engineer. 30 years and counting
Allways liked coding, and interest is growing since I started developing panel software for flight simulation purposes. X-Plane is the only simulator of (my) interest these days and communication out of the box is udp protocol.
iPad is excellent for panel purposes and Pythonista is, for now, the only system talking through that protocol.
So this is the main reason I joined here, but beginning to like Python more and more even if it is quite a struggle coming from coding environments that is not object orientated.
Hope later to return the help I get as a starter when others have unanswered questions.
Thanks for the links.
I have tried to strip your code to the udp stuff only but did not succeed to make something usable with threading.
However I found another more straight forward solution.
I define a socket like this:
port = 49020
s = socket.socket(socket.AF_INET. socket.SOCK_DGRAM)
and in the draw() of a scene listening and unpacking floats:
d = s.recvfrom(1024)
bytes = d
test_float_ex = struct.unpack('f', bytes+bytes+ bytes+bytes)
The code is blocking, but since I need the float values to drive gauges, I think it must be valid.
Have to check the frame rate at some point though .....
By the way, how do you put formatted code in the forum ?
That put a lot in place for me :-)
I had messed around with the load_pil_image but not in conjugation with the init of the image.
I come from Codea where things are a bit more straight forward and direct understandable.
A task like this would be. Define the image - write to context - end context, and when you want to use the image, it is just a call to the name, because it allready exist in memory.
Also I took a mental note on the global issue and use self instead.
I have a fairly complex (static) backdrop image on top of which I draw some animation.
Because I do not understand exactly how Pythonista deals with objects in the draw() function of a scene, I would expect it to be a good idea to pre draw the backdrop to an image and then refresh this every frame.
However is that basicly necessary and a good idea ?
Secondly I am having a lot of trouble trying to define such an image.
The image creation goes fine but no matter what I try to draw, it allways ends up as a white rectangle.
Sorry to be a little un specific and not showing any code, but is there an example somewhere showing this for a scene setup() and draw() ?
On second thoughts, here are my code in the scene...
def setup(self): global img img = Image.new("RGB", (300,300)) draw = ImageDraw.Draw(img) draw.line((0,0,200,200),fill=200) del draw def draw(self): background(0.09,0.09,0.102) global img image('img',300,300,300,300)