Skip to content

Instantly share code, notes, and snippets.

@komoto48g
Last active May 3, 2023 17:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save komoto48g/ba11322fcd325f46102deba589c23b08 to your computer and use it in GitHub Desktop.
Save komoto48g/ba11322fcd325f46102deba589c23b08 to your computer and use it in GitHub Desktop.
Sleep tight tonight.
"""Sleep tight
:caution: Don't gaze too long.
"""
import numpy as np
import wx
import wx.lib.throbber as throb
N = 256
def ctf(phase):
r = 20 * np.arange(-N/2, N/2) / N
X, Y = np.meshgrid(r, r)
f = np.sin(X**2 + Y**2 - phase * 2 * np.pi)
src = (255 * f ** 2).astype(np.uint8)
buf = src.repeat(3,1).tobytes()
return wx.Image(N, N, buf)
class TestPanel(wx.Panel):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
images = [ctf(x).ConvertToBitmap() for x in np.arange(10)/10]
self.throb = throb.Throbber(self, -1, images, frameDelay=0.1,
label="You're sleepy.\n"
"You're sleeping.\n"
"You sleep tight...\n")
self.throb.Font = wx.Font(14,
wx.FONTFAMILY_DEFAULT,
wx.FONTSTYLE_NORMAL,
wx.FONTWEIGHT_EXTRABOLD)
self.throb.Start()
## self.throb.Rest()
if __name__ == "__main__":
app = wx.App()
frm = wx.Frame(None)
frm.panel = TestPanel(frm)
frm.Show()
app.MainLoop()
@komoto48g
Copy link
Author

AGDRec_20230504_011129 agm_clip

@komoto48g
Copy link
Author

Buy me a coffee...
Buy me a coffee...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment