Go to advanced search

by paddyg
Thu Jul 13, 2017 4:57 pm
Forum: Python
Topic: Porting a C Python module to Python 3
Replies: 6
Views: 399

Re: Porting a C Python module to Python 3

... ought to be possible. You could use the Image.tobytes() then somehow frombytes(). However I tried for a long time to improve the efficiency of pi3d and ended up using numpy. Let me know if you figure out a way. EDIT. OK seems to be as easy as im = Image.open(PATH + 'lenna_l.png') img = im.tobytes() ...
by paddyg
Fri Jun 16, 2017 12:06 pm
Forum: Python
Topic: PI3D - Use keyboard to open a new 2D "window".
Replies: 8
Views: 488

Re: PI3D - Use keyboard to open a new 2D "window".

Ash, sorry it was a bit terse! The point I was trying to get across was that you could have a host of different 'things' (in your application parameters for displaying info on different dials, say) and set them up with each variable being named in isolation, which is what the red_val, blue_val, gree...
by AshPowers
Fri Jun 16, 2017 10:54 am
Forum: Python
Topic: PI3D - Use keyboard to open a new 2D "window".
Replies: 8
Views: 488

Re: PI3D - Use keyboard to open a new 2D "window".

Paddy, Much thanks for your input here.. Unfortunately I'm having difficulty grasping what you have described. :( Do you mind giving me some elaboration? In your first CODE section you define "vals" as a list of color attributes with two additional numeric values grouped with each. The numeric struc...
by paddyg
Fri Jun 09, 2017 9:21 am
Forum: Python
Topic: PI3D - Use keyboard to open a new 2D "window".
Replies: 8
Views: 488

Re: PI3D - Use keyboard to open a new 2D "window".

... code (as I do with argument a above) in order to allow the rendering to be done there. Also, if you need to import modules (such as time, math, pi3d) in the included file this doesn't cause a doubling up of processing and waste of time - python can tell that the import has already been done ...
by AshPowers
Fri Jun 09, 2017 12:29 am
Forum: Python
Topic: PI3D - Use keyboard to open a new 2D "window".
Replies: 8
Views: 488

Re: PI3D - Use keyboard to open a new 2D "window".

Paddy, Awesome sauce, my friend. :) Looking through the code I follow it and shouldn't be difficult to implement into what I've already put together. As for mapping the focus, I've come up with a method as best my skills can derive.. The configuration page is broken down into 4 sections of configura...
by paddyg
Thu Jun 08, 2017 9:47 am
Forum: Python
Topic: PI3D - Use keyboard to open a new 2D "window".
Replies: 8
Views: 488

Re: PI3D - Use keyboard to open a new 2D "window".

... out the best way to implement this (NB without copy/paste tweaking. Hint: a couple of functions with an up/down argument would be tidy) import pi3d class Parameter(object): def __init__(self, x, y, min_val, max_val, step_val, curr_val, str_format): self.x = x self.y = y self.min_val = min_val ...
by paddyg
Thu Jun 08, 2017 7:13 am
Forum: Python
Topic: PI3D - Use keyboard to open a new 2D "window".
Replies: 8
Views: 488

Re: PI3D - Use keyboard to open a new 2D "window".

Ash, your method sounds like the best approach to me. it had occurred to be that the lack of mouse would need some complicated system to change focus.

There must be some way to change the background color of a textblock - I will have a look at the code and let you know what I think.
by AshPowers
Thu Jun 08, 2017 1:48 am
Forum: Python
Topic: PI3D - Use keyboard to open a new 2D "window".
Replies: 8
Views: 488

Re: PI3D - Use keyboard to open a new 2D "window".

... I'm thinking that the most bare-bones way would be to allow the user to use the arrowkeys to move to which value they want to change and have pi3d just change the color of the selected value so the user can see which one has the focus. Then the +/- keys can be used to increase or decrease ...
by paddyg
Wed Jun 07, 2017 9:01 pm
Forum: Python
Topic: PI3D - Use keyboard to open a new 2D "window".
Replies: 8
Views: 488

Re: PI3D - Use keyboard to open a new 2D "window".

There is a basic GUI widget thing on pi3d (demo called Gui.py) but it's not very sophisticated for text. Ideally you would open a new interface window with PyQt or similar but this would be behind pi3d drawing surface unless you could dynamically ...
by paddyg
Wed Jun 07, 2017 8:50 pm
Forum: Python
Topic: image viewer (pyhton)
Replies: 2
Views: 275

Re: image viewer (pyhton)

... but I haven't managed to get it to work with gpicview. You can also make image viewing things with tkinter, PyQt etc (my specific knowledge is pi3d which does the job using GPU)
by AshPowers
Tue Jun 06, 2017 11:08 pm
Forum: Python
Topic: PI3D - Use keyboard to open a new 2D "window".
Replies: 8
Views: 488

PI3D - Use keyboard to open a new 2D "window".

Trying to figure out what is going to be the best approach to this with PI3D. In my dashboard application which uses PI3D to display the gauges, needles, etc, I would like to be able to use the keyboard to load a configuration page over all of the gauges/needles ...
by AshPowers
Tue May 23, 2017 7:06 pm
Forum: Python
Topic: PI3D: Can the size of a Sprite be dynamically changed?
Replies: 4
Views: 259

Re: PI3D: Can the size of a Sprite be dynamically changed?

Paddy I want to marry you!

That worked perfectly. I ended up going to 1.5 on the correction (as the display is running 1080 and the image is only 720 high) and it works perfectly.

My God, you are a very powerful wizard! :)

-Ash
by paddyg
Tue May 23, 2017 5:55 pm
Forum: Python
Topic: PI3D: Can the size of a Sprite be dynamically changed?
Replies: 4
Views: 259

Re: PI3D: Can the size of a Sprite be dynamically changed?

If you have a non-moving Camera (shouldn't matter if 3D or not) then you can just add a line after you create it CAMERA.mtrx[1,1] *= 0.5 # this should be the correction factor If you move your Camera around and effectively reset it each frame then you need to do the same inside the while loop after ...
by paddyg
Tue May 23, 2017 7:18 am
Forum: Python
Topic: PI3D: Can the size of a Sprite be dynamically changed?
Replies: 4
Views: 259

Re: PI3D: Can the size of a Sprite be dynamically changed?

... that the scaling happens before rotation whereas you want it after. As you suggest the best way would be to alter the projection matrix which, in pi3d, is held by the Camera object, as this is then applied to all the Shapes as they are drawn. It is probably quite easy but involves a bit of investigation ...
by AshPowers
Tue May 23, 2017 1:49 am
Forum: Python
Topic: PI3D: Can the size of a Sprite be dynamically changed?
Replies: 4
Views: 259

Re: PI3D: Can the size of a Sprite be dynamically changed?

Or, if there is a simpler solution to this that is in PI3D that I am not aware of, that would be great. Can the display size be set in such a way that it will skew the image height of EVERYTHING displayed? The display wants to run 1920X1080 on a native ...
by AshPowers
Mon May 22, 2017 6:40 pm
Forum: Python
Topic: PI3D: Can the size of a Sprite be dynamically changed?
Replies: 4
Views: 259

PI3D: Can the size of a Sprite be dynamically changed?

Trying to determine if I need to rewrite my program and use textures rather than sprites for rotating gauge needles. Unfortunately the widebar 24:9 display simply will not run its native resolution and although I can rescale the background, the rotating needle sprites are short in vertical direction...
by AshPowers
Sun May 14, 2017 1:48 am
Forum: Troubleshooting
Topic: New Display: 1920X720. How to config?
Replies: 12
Views: 647

Re: New Display: 1920X720. How to config?

... need to be added in to drive this display properly. Unfortunately there is no easy workaround for this problem on my end as my application uses pi3d and it is screwing up the scale of rotating sprite components. Circles look like wide ovals when running it in 1920X1440, for obvious reasons. ...
by paddyg
Wed May 10, 2017 6:53 am
Forum: Python
Topic: try: except: else: not acting right at all!!
Replies: 30
Views: 1171

Re: try: except: else: not acting right at all!!

people often eithe use a variable in the while loop so the ptogam can be stopped in a controlled way (as with the pi3d demos) You could do something like while msg != 'stop': or they put the whole loop in a try and tidy up in except keyboardinterrupt.
by AshPowers
Wed May 10, 2017 5:12 am
Forum: Python
Topic: pi3d: TextBlock data input failure
Replies: 1
Views: 157

Re: pi3d: TextBlock data input failure

Problem Solved:

The issue is in the formatting within the TextBlock definition. Characters coming from the phone are strings and the formatting in the TextBlock was expecting integer values.

text_format="{:4.0f}", size=0.50, spacing="C", space=.7,
by AshPowers
Wed May 10, 2017 2:46 am
Forum: Python
Topic: pi3d: TextBlock data input failure
Replies: 1
Views: 157

pi3d: TextBlock data input failure

... default uses the UTF-8 encoding as well. class EgClass(object): pterm = 0 eg_object = EgClass() BACKGROUND_COLOR = (0.0, 0.0, 0.0, 1.0) DISPLAY = pi3d.Display.create(background=BACKGROUND_COLOR) HWIDTH, HHEIGHT = DISPLAY.width / 2.0, DISPLAY.height / 2.0 QWIDTH = HWIDTH/2 # quarter width shader ...
by paddyg
Tue May 09, 2017 7:25 am
Forum: Python
Topic: try: except: else: not acting right at all!!
Replies: 30
Views: 1171

Re: try: except: else: not acting right at all!!

You could use one loop, putting your pi3d stuff in your serial reading loop or vice-versa but you would then need to make sure you didnt have any blocking reads or long sleeps. you would call loop_running() in the loop (ie it doesn't have to ...
by AshPowers
Tue May 09, 2017 12:43 am
Forum: Python
Topic: try: except: else: not acting right at all!!
Replies: 30
Views: 1171

Re: try: except: else: not acting right at all!!

If you look at the bottom of the code snippet I write, you will see the while DISPLAY.loop_running():. This is for pi3d and once the program gets to this loop, it runs in this loop forever, continually redrawing the screen. This is also where all of my data acquisition is occuring ...
by Douglas6
Tue May 09, 2017 12:14 am
Forum: Python
Topic: try: except: else: not acting right at all!!
Replies: 30
Views: 1171

Re: try: except: else: not acting right at all!!

I'm afraid I'm not familiar with Pi3d and it's display loop(?). You might need a separate thread, and/or a hook into the UI loop, if that's what it is.
by AshPowers
Mon May 08, 2017 11:31 pm
Forum: Python
Topic: try: except: else: not acting right at all!!
Replies: 30
Views: 1171

Re: try: except: else: not acting right at all!!

... for only around that timespan again. So I have tested your code in a new blank file and it works just as intended. Only issue is that I am using pi3d and the while DISPLAY.loop_running(): is running, that is where the entirety of the program runs in. I have been trying to figure out how to use ...
by AshPowers
Sat May 06, 2017 9:11 pm
Forum: Python
Topic: pi3d - Sprites laying over textblock????
Replies: 6
Views: 325

Re: pi3d - Sprites laying over textblock????

... the issue. Another ID ten T error. :P But it is good to know about the maximum number of characters parameter. The 13 character value used in the pi3d example fortunately is large enough to hold each of the data values so it never became an issue.. Lucky me! HA! :) Thanks again!

Go to advanced search