Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- import wx
- from datetime import date
- class MyFrame(wx.Frame):
- def __init__(self, *args, **kwds):
- kwds["style"] = wx.ICONIZE|wx.STAY_ON_TOP # remove stay on top if u want
- wx.Frame.__init__(self, *args, **kwds)
- self.panel_1 = wx.Panel(self, -1)
- self.deys = ['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday']
- self.nfo = ''
- self.__set_properties()
- self.__do_layout()
- self.panel_1.Bind(wx.EVT_LEFT_DOWN, self.upfresh, self.panel_1)
- self.panel_1.Bind(wx.EVT_RIGHT_DOWN, self.kloz, self.panel_1)
- def __set_properties(self):
- self.SetTitle("untitled")
- self.SetSize((50, 5))
- self.SetPosition((1220, 795)) # sidakah galhaala =)
- self.panel_1.SetBackgroundColour(wx.BLACK)
- self.panel_1.SetToolTipString("this will change on refresh")
- # tooltip holds reminders
- self.refrush()
- def __do_layout(self):
- sizer_1 = wx.BoxSizer(wx.VERTICAL)
- sizer_1.Add(self.panel_1, 1, wx.EXPAND, 0)
- self.SetSizer(sizer_1)
- self.Layout()
- def refrush(self):
- g = ''
- pathk = "path/to/dayx.txt"
- with open(pathk, "r") as f:
- g = f.read()
- f.close()
- wde = "x"+self.deys[date.weekday(date.today())]
- xx = g.find(wde[:3])
- kt = g.count(wde[:3])/2
- sey = ''
- seyx = ''
- if xx != -1: # if a match for today is found, do the extraction
- for i in range(kt):
- a = g.find(wde[:3])+5
- b = g.find("/"+wde[:3])-1
- sey = sey+str(i+1)+": "+g[a:b]+"\n"
- g = g[(b+3):]
- seyx = "you have "+str(kt)+" things to do today!\n"
- self.nfo = seyx+sey[:-1]
- else:
- self.nfo = "you have no reminders for today"
- self.panel_1.SetToolTipString(self.nfo)
- def kloz(self, event):
- self.Close()
- event.Skip()
- def upfresh(self, event):
- self.refrush()
- event.Skip()
- # [mouse]right down will close it
- # [mouse]left down will refresh it
- # mouseover will show tooltip
- if __name__ == "__main__":
- app = wx.PySimpleApp(0)
- wx.InitAllImageHandlers()
- frame_1 = MyFrame(None, -1, "")
- app.SetTopWindow(frame_1)
- frame_1.Show()
- app.MainLoop()
Add Comment
Please, Sign In to add comment