#!/usr/bin/python # -*- coding: UTF-8 -*- from tkinter import * import sympy from sympy import solve root = Tk() root.title('鸡兔同笼') root.geometry('220x180') chickennum=IntVar() rabitnum=IntVar() headnum = IntVar() headnum.set('30') legnum = IntVar() legnum.set('88') def ButtonAnwser(): x = sympy.symbols('aa') y = sympy.symbols('bb') cc = solve([x + y - headnum.get(), 2 * x + 4 * y - legnum.get()]) dd = cc.values() chinum = list(dd)[0] rabnnum = list(dd)[1] chickennum.set(chinum) rabitnum.set(rabnnum) # -------------------------------------界面--------------------------------- Text0 = Label(root, text='Input:') Text0.grid(row=0, column=0, sticky=W) Text1 = Label(root, text='heads:') Text1.grid(row=1, column=0, sticky=W) Sentence1 = Entry(root, textvariable=headnum) Sentence1.grid(row
python 鸡兔同笼GUI
最新推荐文章于 2023-12-15 15:08:36 发布