Go to advanced search

by Paeryn
Tue Oct 17, 2017 1:35 pm
Forum: Python
Topic: What can be done about Python 3.5 slowness?
Replies: 27
Views: 417

Re: What can be done about Python 3.5 slowness?

root@raspberrypi:~# cat pass.py #!/usr/bin/env python3.5 pass root@raspberrypi:~# cython3 --embed pass.py -o pass.c; gcc $(pkg-config --libs --cflags python3) pass.c -o pass root@raspberrypi:~# time python3.5 -m pass real 0m0.916s user 0m0.830s sys 0m0.070s root@raspberrypi:~# Oh. Perhaps it's not ...
by Paeryn
Tue Oct 17, 2017 11:48 am
Forum: Python
Topic: python3 tkinter make a button look the same
Replies: 13
Views: 234

Re: python3 tkinter make a button look the same

menuImage = Image.open('menuImage.png') menuImage = menuImage.resize((40, 40)) bar.image = menuImage menuImage = ImageTk.PhotoImage(menuImage) bar.create_image(2, 2, image=menuImage, anchor='nw') You are keeping a reference to the resized version of the original image rather than the ImageTk.PhotoI...
by Paeryn
Tue Oct 17, 2017 3:45 am
Forum: Troubleshooting
Topic: unable to start .sh file at boot
Replies: 8
Views: 215

Re: unable to start .sh file at boot

Unless your program is compiled then you have to do: bash path/filename or sh path/filename It does not matter if the file has execute permissions or not. It will run either way from CL. Erm... lxterminal attempts to run the given file (as long as it has executable permissions) using execv() , that...
by Paeryn
Tue Oct 17, 2017 1:24 am
Forum: Troubleshooting
Topic: unable to start .sh file at boot
Replies: 8
Views: 215

Re: unable to start .sh file at boot

I did notice that the my_start.sh is not executable according to the properties. I tried the chmod -777 command but it says permission denied. To add execute permissions you want to do (this gives everyone execute permission, to just add execute permission for the user use u+x ) chmod +x my_start.s...
by Paeryn
Mon Oct 16, 2017 8:50 pm
Forum: Python
Topic: python3 tkinter make a button look the same
Replies: 13
Views: 234

Re: python3 tkinter make a button look the same

You need to keep a reference to the image whilst ever Tk is using it. In your example menuImage goes out of scope at the end of the function main() and will be deleted by Python so by the time Tk tries drawing it in root.mainloop() it will have gone. This is because Python's garbage collector has no...
by Paeryn
Mon Oct 16, 2017 6:43 pm
Forum: Python
Topic: python3 tkinter make a button look the same
Replies: 13
Views: 234

Re: python3 tkinter make a button look the same

It works for me, I take it you have rendered the window at least once e.g. root.update() before you tried to read it's width with root.winfo_width() otherwise it will typically return 1.
by Paeryn
Mon Oct 16, 2017 5:27 pm
Forum: Bare metal
Topic: RPi3 MMU question
Replies: 13
Views: 310

Re: RPi3 MMU question

I also use ID_AA64MMFR0_EL1.PArange for IPS, and I check for 4k granule support (btw that register reads as 0x0000000000001122, so A53 really do support all three granule sizes). If that is the value in the register then it says that 16k isn't supported, 4k and 64k use 0 to mean supported but 16k u...
by Paeryn
Mon Oct 16, 2017 4:44 pm
Forum: Python
Topic: python3 tkinter make a button look the same
Replies: 13
Views: 234

Re: python3 tkinter make a button look the same

You can use a canvas import tkinter as tk from PIL import Image, ImageTk def image_clicked(event): print('Image clicked at ({x}, {y})'.format(x=event.x, y=event.y)) window = tk.Tk() frame = tk.Frame(window, relief=tk.FLAT) frame.grid_rowconfigure(0, weight=1) frame.grid_columnconfigure(0, weight=1) ...
by Paeryn
Mon Oct 16, 2017 1:27 am
Forum: Troubleshooting
Topic: unable to start .sh file at boot
Replies: 8
Views: 215

Re: unable to start .sh file at boot

How exactly have you tried? As a quick test I did this and it works for me, when the desktop starts a terminal window is opened with the bash script running, when the script ends the window closes. /home/pi/my_start.sh #!/bin/bash echo "Hello" sleep 5 echo "Goodbye" sleep 1 /home/pi/.config/autostar...
by Paeryn
Mon Oct 16, 2017 12:22 am
Forum: Troubleshooting
Topic: 1998 imac keyboard recognized only as hub
Replies: 1
Views: 68

Re: 1998 imac keyboard recognized only as hub

It's seeing a hub as that is the device type that you are plugging in, basically it's a 3-port USB hub with a keyboard permanently connected to one of the ports. Is there any information in the kernel log /var/log/messages (it'll be near the end of the file) after you plug the keyboard in? You shoul...
by Paeryn
Sun Oct 15, 2017 9:55 pm
Forum: Python
Topic: python3 tkinter make a button look the same
Replies: 13
Views: 234

Re: python3 tkinter make a button look the same

One way is to use the fact that tk always sets a normal button to SUNKEN when pressed, if you create the button as SUNKEN then the pressed and unpressed states are the same though you have the side effect of always having the button text slightly offset due to the sink, the borderwidth=0 prevents th...
by Paeryn
Sat Oct 14, 2017 1:37 pm
Forum: Troubleshooting
Topic: import subprocess nuance
Replies: 3
Views: 88

Re: import subprocess nuance

import subprocess will, if not previously imported, create a new module object and load the module. It then creates a new name subprocess at the current scope and binds it to the loaded subprocess module. If you import at file level then any functions called after that (within the same file) can al...
by Paeryn
Sat Oct 14, 2017 8:46 am
Forum: C/C++
Topic: Problem with longjmp on Pi Zero W
Replies: 15
Views: 654

Re: Problem with longjmp on Pi Zero W

RichardUK wrote:
Sat Oct 14, 2017 7:57 am
Anyway I think I may have taken the thread a little off piste, which is why I've reached out to the OP to see if I could find a solution or the issue.
I hope you PM'd the right person as you PM'd me on this point and I couldn't let you know via PM as you have PM receipt disabled.
by Paeryn
Fri Oct 13, 2017 10:48 pm
Forum: C/C++
Topic: Problem with longjmp on Pi Zero W
Replies: 15
Views: 654

Re: Problem with longjmp on Pi Zero W

Just do a divide by zero, that is even simpler, it's not right either. but it'll let you bail at any point. Will quit the interpreter too. (P.S don't ever do that :) ) Not right either ? longjmp isn't the best thing in the world but it's not wrong whereas doing a divide by zero to force a jump to a...
by Paeryn
Fri Oct 13, 2017 10:09 pm
Forum: Beginners
Topic: Sudo User Permission
Replies: 3
Views: 141

Re: Sudo User Permission

As long as you are in the user's home directory or one that is lower down from the user's home directory (i.e. a sub-directory of the user's home directory etc.) then you should have permission to change into its sub directories and create & delete files & directories unless you've altered the direc...
by Paeryn
Wed Oct 11, 2017 2:20 pm
Forum: Graphics programming
Topic: EGL and OpenVG broadcom extensions, what they do?
Replies: 17
Views: 1018

Re: EGL and OpenVG broadcom extensions, what they do?

If you want access to any of the codec blocks then IL or MMAL are the only routes I'm aware of. I have no idea how VG is handling the JPEG as it doesn't appear to be calling into the firmware JPEG codec. Looking at the code Gavinmc42 linked to that looks like it is using a version of ajstarks' shap...
by Paeryn
Mon Oct 09, 2017 12:23 pm
Forum: Python
Topic: " unrecognized command line option ‘-msse3’" During Compile
Replies: 4
Views: 248

Re: " unrecognized command line option ‘-msse3’" During Compile

No, you need to take that option out of the module's setup. You can do this by getting pip to just download it first, then edit the file and get pip to install the local version. This should do everything needed to download, edit and install the vtc-scrypt module. If the download ever gets a newer v...
by Paeryn
Mon Oct 09, 2017 12:37 am
Forum: Python
Topic: " unrecognized command line option ‘-msse3’" During Compile
Replies: 4
Views: 248

Re: " unrecognized command line option ‘-msse3’" During Compile

Looks like one of its dependencies (vtc-scrypt) is failing to install because it is trying to call gcc with an option (-msse3) that is for x86 processors and the Arm compiler doesn't understand it.
by Paeryn
Sun Oct 08, 2017 2:21 am
Forum: Graphics programming
Topic: retro xwindows programming question
Replies: 4
Views: 305

Re: retro xwindows programming question

It's been a long time since I used Xtoolkit, I may mis-remember a few details... You can add children to a parent before realising, it's just until a widget is realised it doesn't have a window. Xtoolkit doesn't ask the X server to create windows until the end of XtRealizeWidget() to avoid sending l...
by Paeryn
Sat Oct 07, 2017 6:05 pm
Forum: Graphics programming
Topic: retro xwindows programming question
Replies: 4
Views: 305

Re: retro xwindows programming question

Are you perhaps trying to get the window of a widget that hasn't yet been realised? Just creating a widget doesn't automatically give it a window. A window id of 0 means there is no window. Code was taken from an old motif manual - I just added the XtWindowOfObject() calls. #include <stdio.h> #inclu...
by Paeryn
Sat Oct 07, 2017 2:26 pm
Forum: General discussion
Topic: Bash script help ? Play videos on PI
Replies: 7
Views: 373

Re: Bash script help ? Play videos on PI

No worries -- I may do something myself to learn more about bash. Working great but the keyboard shortcuts don't work so can't get out of the script. I suppose it has something to do with it being in a while loop? Can't even bring up LX terminal on the keyboard and I hate doing a cold power off on ...
by Paeryn
Sat Oct 07, 2017 2:00 pm
Forum: General discussion
Topic: Bash script help ? Play videos on PI
Replies: 7
Views: 373

Re: Bash script help ? Play videos on PI

btw -- is there anything I can do in the script to get omxplayer to play the files randomly ? probably not -- even if I could it would repeat played files probably. Playing files in a random order without repeating (makes an array of files then swaps each element with a random element to leave you ...
by Paeryn
Sat Oct 07, 2017 2:48 am
Forum: OpenVG
Topic: Using Polyline
Replies: 2
Views: 293

Re: Using Polyline

You need to call StrokeWidth(VGfloat width); with the width you want strokes to be drawn (typically 1.0f). Start(); calls StrokeWidth(0.0f); which disables drawing of strokes (strokes are the edges of shapes) and lines are only drawn as strokes. You'll also want to set the colour of the stroke with ...
by Paeryn
Sat Oct 07, 2017 12:53 am
Forum: General discussion
Topic: Bash script help ? Play videos on PI
Replies: 7
Views: 373

Re: Bash script help ? Play videos on PI

That should work, unless your video filenames have spaces in them, then it won't as omxplayer will see the filename as only up to the first space and hence not play it. Change the code slightly so you can see what is happening, i.e. don't clear the screen each time, don't redirect omxplayer's output...
by Paeryn
Wed Oct 04, 2017 10:56 pm
Forum: Python
Topic: How To Import A Module Within A Module?
Replies: 7
Views: 309

Re: How To Import A Module Within A Module?

Oops, I confused myself with how import works vs from ... import ... . As paddyg said, a module is only loaded once the first time it is imported, import creates one new name (it defaults to calling it whatever the module is called) in the current scope that is bound to the actual module object (it'...

Go to advanced search