Little, by little my calculator is getting a look I want.
However, I find that using Tkinter is not very intuitive, and i cannot find detail documentation.
have a look at this
# menu-example-2.py
#from Tkinter import *
#root = Tk()
#def hello():
#print "hello!"
## create a toplevel menu
#try:
#menubar = Menu(root)
#except: pass
#menubar.add_command(label="Hello!", command=hello)
#menubar.add_command(label="Quit!", command=root.quit)
## display the menu
#root.config(menu=menubar)
#mainloop()
from Tkinter import *
class CalcApp:
def __init__ ( self, parent ):
#define menubar
try:
self.menubar = Menu ( parent )
except: pass
#create edit menu
self.edit_menu = Menu ( self.menubar, tearoff = 0 )
self.edit_menu.add_command ( label = "Copy", command = self.hello )
self.edit_menu.add_command ( label = "Paste", command = self.hello )
self.menubar.add_cascade ( label = "Edit", menu = self.edit_menu )
#create about
self.menubar.add_command ( label = "About", command = self.hello )
parent.config ( menu = self.menubar )
#define how main windwow will look
parent.title ( "Calculator" )
parent.geometry ( "255x228+0+0" )
parent.resizable ( width = False, height = False )
try:
self.fr_entry = Frame ( parent )#here, I tried to define height and width, but no luck
except: pass
self.fr_entry. pack ( )
self.entry = Entry ( self.fr_entry, justify = "right", width = 45, relief = "groove" )
self.entry.focus_force ( )
self.entry.pack ( )
def hello ( self ):
print "hello"
root = Tk ( )
calc = CalcApp ( root )
root.mainloop ( )
Now I want to disable user to enter more than 20 numbers (numbers only) and I want to make Entry field a little more in height, just like win calcluator?