Posts

Showing posts from September, 2020

Notepad using Python

  from  tkinter  import * import  tkinter.messagebox  as  tmsg from  tkinter.filedialog  import  askopenfilename, asksaveasfilename import  os def   newFile ():      global   file     root.title( "Untitled-Notepad" )      file = None     TextArea.delete( 1.0 , END) def   openFile ():      global   file      file =askopenfilename( defaultextension = ".txt" ,  filetypes =[( "All Files" ,  "*.*" ), ( "Text Documents" ,  "*.txt" )])      if   file == "" :          file = None      else :         root.title(os.path.basename( file )+  "- Notepad by Elalita" )         TextArea.delete( 1...

Basic Calc using Python Tkinter

  from  tkinter  import * root=Tk() root.geometry( "300x520" ) root.title( "Calculator by Elalita" ) scvalue=StringVar() scvalue.set( " " ) screen=Entry(root,  textvar =scvalue, font = "lucida 40 bold" ) screen.pack( fill  =X, ipadx = 8 ,  padx = 10 ,  pady = 10 ) def   click ( event ):      global  scvalue     text=event.widget.cget( "text" )      print (text)      if  text== "=" :          if   scvalue.get().isdigit():             vlaue= int (scvalue.get())          else :              try :                 value= eval (screen.get())   ...