This post is all about the first app that I made using python language. (Finally, I made an app! 😀 )
Name of this app is ‘ NoteIt ‘
Some of us do have a habit of keeping a diary, or I would say just keeping a note (read, memo) of stuff happening in day to day life. Some of us do maintain a record of daily expenses, also! But then, since we are humans( read, lethargic 😛 ) we tend to postpone and think “Kal likh loonga” 😀
The main problem is we don’t feel like taking a notebook/dairy and then find a pen and note the things. We are busy people you see! 😉
So I made an app which is an editor, where you can write stuff you want and then click save. It automatically saves the file with today’s date and time as the file name. So at the end of the month you will have 30/31 files(that is, if you make one everyday) with their names as dates and time when you created that file.
Easy to use and awesome for keeping record of stuff. 🙂
Screen shots of the app:
Type in the text and save the file.
It gets saved with the name as date and time when you saved it. Done! 🙂
For the ones who want to know how did I do it:
To start with, I made a CLI (command-line interface) and got done with the basic things that this app would do.
The basic CLI code of this app is:
import datetime now = datetime.datetime.now() now1=str(now)[:19] f=open(now1+'.txt','w') s="" while s!='quit'+"\n": s=raw_input() s+="\n" f.write(s) f.close()
Then I thought of making GUI so that people find it easy and comfortable to use.
I asked people of what GUI platform do I use. I got a lot of options. Then I tried to skim through a few and found wxPython to be the one which suited all my requirements. I learnt how to use wxPython and then made a basic GUI for NoteIt.
The actual GUI code for this app is:
import wx import datetime class Example(wx.Frame): def __init__(self, parent, title): super(Example, self).__init__(parent, title=title, size=(260, 180)) self.InitUI() self.Centre() self.Show() def InitUI(self): menubar = wx.MenuBar() fileMenu = wx.Menu() self.SetMenuBar(menubar) nmi = wx.MenuItem(fileMenu, wx.ID_NEW, '&New\tCtrl+N') fileMenu.AppendItem(nmi) smi = wx.MenuItem(fileMenu, wx.ID_SAVE, '&Save\tCtrl+S') fileMenu.AppendItem(smi) qmi = wx.MenuItem(fileMenu, wx.ID_EXIT, '&Quit\tCtrl+W') fileMenu.AppendItem(qmi) self.Bind(wx.EVT_MENU, self.new, nmi) self.Bind(wx.EVT_MENU, self.OnQuit, qmi) self.Bind(wx.EVT_MENU, self.savetext, smi) menubar.Append(fileMenu, '&File') self.SetMenuBar(menubar) self.tv=wx.TextCtrl(self, style=wx.TE_MULTILINE) def new(self, e): self.tv.Clear() def savetext(self,e): s=self.tv.GetValue() if s: now = datetime.datetime.now() now1=str(now)[:19] f=open(now1+'.txt','w') f.write(s) def OnQuit(self, e): self.Close() if __name__ == '__main__': Example(None, title='') app = wx.App() app.MainLoop()
Making a GitHub repository, too.
A basic app, though, feels wonderful to make one.
This was done because of my mentor-friend Jay Rambhia. Had he not inspired me to get going with the idea, I would have never implemented it.
This was my first app, what’s yours?