Strange behavior due to wx.Frame.SetTitle - macos

In a wxPython application, which i am porting to Mac OSX, I set title of app frame every 500msec in update UI event, and due to that all the panels and windows are refreshed. That seems strange to me and almost halts my application which has many custom drawn controls and screens.
I wanted to know what could be the reason behind it, is it normal for MAC?
Here is a self-constrained script which replicates the scenario using timers. It keeps on printing "on paint" every 500ms because in timer I set title every 500ms.
import wx
app = wx.PySimpleApp()
frame = wx.Frame(None, title="BasePainter Test")
painter = wx.Panel(frame)
def onPaint(event):
dc = wx.PaintDC(painter)
print "onPaint"
painter.Bind(wx.EVT_PAINT, onPaint)
def loop():
frame.SetTitle(frame.GetTitle())
wx.CallLater(500, loop)
loop()
frame.Show(True)
app.SetTopWindow(frame)
app.MainLoop()
My system details:
>>> sys.version
'2.5 (r25:51918, Sep 19 2006, 08:49:13) \n[GCC 4.0.1 (Apple Computer, Inc. build 5341)]'
>>> wx.VERSION
(2, 8, 10, 1, '')
>>> os.uname()
('Darwin', 'agyeys-mac-mini.local', '9.8.0', 'Darwin Kernel Version 9.8.0: Wed Jul 15 16:55:01 PDT 2009; root:xnu-1228.15.4~1/RELEASE_I386', 'i386')

Alas, I'm not sure of the specific issue. However, when you have a sample which demonstrates the problem but are stumped, I've always had great luck by emailing the wxpython-users mailing list and attaching the sample. You should get a response pretty quickly on if there is something you can do to fix it, or if not, that you should file a bug in the tracker.
I have had plenty of problems solved this way, and when I do have to file bugs, they are usually resolved quite speedily. Hope this helps!

It is a bug in wxPython (OSX-Carbon).
Filed a bug http://trac.wxwidgets.org/ticket/11920
Discussion:
http://groups.google.com/group/wxpython-users/browse_thread/thread/2430e0ef7ff1fb8/8f384968a42136d7

Related

Replace linux-raspberrypi with core/linux-rpi-legacy?

When I ran 'pacman -Syu' today on an rpi3 Arch-Linux installation, the following question
was asked: Replace linux-raspberrypi with core/linux-rpi-legacy? [Y/n]
Is this a simple renaming or is this an
important change impacting the system's future?
Although the other answer was first, here's the relevant information from the forum:
Raspberry Pi kernel rename coming soon
Post by graysky ยป Sun Nov 28, 2021 12:20 pm
In a rebranding move, we
are changing the names of the two kernel packages for the RPi series
of devices to more adequately represent the intended platform.
linux-raspberrypi --> linux-rpi-legacy (RPi 1, 2, Zero, Zero W)
linux-raspberrypi4 --> linux-rpi (RPi 3, 4, 400, and Zero 2 W)
Once the new packages are built and hit your mirror, pacman should
automatically handle it by asking you if you would like to replace the
old package with the new one. Say Y to proceed.
The full name of the thread is "Raspberry Pi kernel rename coming soon"
The link on the forum for me is this
Always look first into the forums:
https://archlinuxarm.org/forum/viewtopic.php?f=3&t=15683

Extreme lag while developing using Mac OS

Im working on Mac Book Pro, OS : Catalina 10.15.7.
At first I was using VS Code to develop in Go but the ( fan?? ) i guess started sounding like a turbo Jet after a while up to the point that the entire OS would shutdown on its own. ( I do not exactly recall what the message said, it was a black screen with white text saying something like your cpu utilization was too high etc, etc and we had to restart the system ).
Today I am trying to run this Python3 script :
#!/usr/local/bin/python3
import csv
import json
import boto3
import time
from multiprocessing import Pool
dynamodb = boto3.resource('dynamodb', endpoint_url='http://localhost:4566', region_name='us-east-2')
table = dynamodb.Table('myTable')
collection = []
count = 0
with open('items.csv', newline='') as f:
reader = csv.DictReader(f)
for row in reader:
obj = {}
collection.append({
"PK" : int(row['id']),
"SK" : "product",
"Name" : row['name']
})
def InsertItem(i):
table.put_item(Item=i)
if __name__ == '__main__':
with Pool(processes=25) as pool:
result = pool.map(InsertItem, collection, 50)
print(result)
And the same behavior occurs ( it does not seem to be related to VS Code now since im directly running this script from the terminal ), the fans are extremely noisy, the performance drops to almost 0 and i get the lollypop mouse pointer of death. ( which seems to be an omen of the PC about to restart itself ) and the process I mentioned above happens again.
Some hints of what is going on :
Im not the only one having this problem. Another teammate does React and is seeing the same behaviour. ( Hs is using VsCode too but I think the problem is more generic ).
It seems to appear only with "intensive" tasks. ( And please take "intensive" with a grain of salt. I do the very same tasks in my Ubuntu Machine with half the RAM and it does not even flinch ).
I have been using Mac for years, and I do not recall having this issue.
So, my question is, is someone else noticing something similar? Is there some workaround for this?
Last note: The python script you see above I tested last week, it did not take even 2 minutes to run. today with these issues its just lingers forever. And I can see for the prints I am doing that it attempts to insert stuff but it freezes without moving forward.

pythonw.exe crashes when using pyo in PsychoPy

I'm generating an experiment in PsychoPy (v1.84.2 on Windows 7), which requires a short tone.
The lines of code around the sound generation are:
print '1'
startTone = sound.Sound(value='B', secs=0.15, octave=5, sampleRate=44100, bits=16, name='', autoLog=False)
print '2'
instructions_text_stim = visual.TextStim(win, text='Press any key to start.', pos = [0,0], height=2)
print '3'
instructions_text_stim.draw()
print '4'
win.flip()
print '5'
PsychoPy crashes as soon as the visual.TextStim is drawn (I get 1-3 in the output window). The crash is a "pythonw.exe has stopped working" popup, which forces the window to be closed.
Without the sound generation, the experiment runs without a hitch. The tone is played elsewhere in the script, but the crash is at the assignment. Additionally, the code runs on OSX.
I've seen people have had issues with pyo compatibility before, as well as the pythonw.exe crash. Has anyone had the combination, or found a work-around?
Thanks
Updating to PsychoPy v1.85.0 and using the audio library "sounddevice" fixed this issue.

Hello World for OpenGL+GLUT in Haskell not working on OSX Lion

The following program:
import Graphics.Rendering.OpenGL
import Graphics.UI.GLUT
main = do
(progname, _) <- getArgsAndInitialize
createWindow "Hello World"
mainLoop
compiled with the command:
ghc -package GLUT HelloWorld.hs -o HelloWorld
as explained on this tutorial fails to execute on OSX Lion, displaying the following error message:
2013-09-07 20:31:20.372 aff[8561:60b] GLUT Warning: The following is a new check for GLUT 3.0; update your code.
2013-09-07 20:31:20.373 aff[8561:60b] GLUT Fatal Error: redisplay needed for window 1, but no display callback.
First of all, I'm not on OS X and could not reproduce the error (nor the warning for that matter). Furthermore I'm probably using different version of all the libraries. Note that these kind of differences between operating systems are (unfortunately) not that uncommon. When running the program I got a copy of the pixels underneath it, like the tutorial writer seems to expect.
The error message states
redisplay needed for window 1, but no display callback
Thus my guess is that you need to register the displayCallback. So, in line with the next part of the tutorial, I added
displayCallback $= clear [ ColorBuffer ]
before the mainloop. Yet it did not fix the pixel carrying behaviour. To fix that I changed it to
displayCallback $= (clear [ColorBuffer] >> swapBuffers)
Which also updates the buffer on screen.
P.S. Note that the tutorial is from 2006, it might have bit rotted a bit. Furthermore OpenGL 2.1 was at that time the latest version of OpenGL.

See what causes deadlock on pthread_mutex_lock

I have a Core Data iOS app that uses private queue concurrency in a background process. I'm getting a deadlock that makes the UI freeze up from time to time (fairly regularly, to be honest) - but all the info I get from the debugger (LLDB) is that it is stuck on pthread_mutex_lock. The stack trace is no longer than that, which makes debugging near on impossible:
thread #1: tid = 0x2503, 0x3b5060fc libsystem_kernel.dylib`__psynch_mutexwait + 24, stop reason = signal SIGSTOP
frame #0: 0x3b5060fc libsystem_kernel.dylib`__psynch_mutexwait + 24
frame #1: 0x3b44f128 libsystem_c.dylib`pthread_mutex_lock + 392
The XCode process pane is similarly only showing those two entries on the stack.
I'm quite new to this multithreading stuff so am at a total loss where to begin with fixing the issue. Any suggestions for how to go about debugging this?
Your stack is obviously longer than two frames, you can't start a thread with pthread_mutex_lock. So the truncation of the stack frame is pretty clearly just a bug in the lldb unwinder. If you have an ADC account, please file a bug about this at bugreporter.apple.com. Also if you're not using the most recent version of lldb you can get your hands on you might want to try that, maybe it fixed whatever bug you are seeing. You can install multiple Xcode's side by side so you don't have to remove the one you are currently using to try a newer one.
You might also try another tool that will give you a backtrace (e.g. the Instruments time profiler) when your app gets into this state, since it uses a different unwinder. That will at least let you see what the full backtrace is.

Resources