利用内置的tkinter/Tkinter库可实现基本的GUI程序。
示例图
源代码
#coding=utf8
"""
@author:kinegratii
"""
try:
from tkinter import *
except ImportError:
from Tkinter import *
class Cal(Frame):
def __init__(self):
Frame.__init__(self)
self.pack(expand = YES,fill = BOTH)
self.master.title('Calculator By Kinegratii')
self.master.geometry('400x400')
self.draw()
def add_button(self,parent,side,text,command = None):
b = Button(parent,text = text,command = command)
b.pack(side = side,expand = YES,fill = BOTH)
return b
def add_frame(self,parent,side):<