猿问

Python 3.6 tkinter 表示未定义 GROOVE

几分钟前,下面的程序运行良好。我进行了更改,运行了代码,犯了一个小错误,Spyder 崩溃了,现在它要么找不到 Frame 或 Groove 或其他东西。目前它说没有定义GROOVE。


尝试用小写字母和引号来写。当我使用引号时,它说: TclError:浮雕“凹槽”:必须是平的、凹槽的、凸起的、脊的、实心的或凹陷的。当我做没有引号的小写或大写时,表示没有定义凹槽。


from RiskFactorConversion import *

from tkinter import ttk, StringVar, Frame, Label, Tk, Entry


mainwindow = Tk()

mainwindow.title("Risk Factor Conversion")

datatype = StringVar()

dataconvention = StringVar()

mdlname = StringVar()

instancevalue = StringVar()

axisvalue = StringVar()



def g():

    datatype = e1.get()

    dataconvention = e2.get()

    mdlname = e3.get()

    instancevalue = e4.get()

    r1 = rates.srtqualifier(mdlname,datatype,dataconvention,instancevalue)

    l5["text"] =r1.makequalifier()


def f():

    datatype = e5.get()

    dataconvention = e6.get()

    axisvalue = e8.get()

    fx1 = fx.felixfxvol(datatype,dataconvention,axisvalue)

    l11["text"] =fx1.fxvol()


def h():

    datatype = en1.get()

    dataconvention = en2.get()

    fx2 = fx.murexfx(datatype,dataconvention)

    la4["text"] =fx2.makequalifier()


#########Felix Frame####################################

frame1 = Frame(bg="white", colormap="new", padx = 10, relief=GROOVE, borderwidth=2)

frame1.grid(row = 0, column = 0)

l0 = Label(frame1, text= "FELIX Rates", pady =5, font = ('Georgia',14,'bold'), bg="white")

l0.grid(row = 0, column = 0,sticky= W )

l1 = Label(frame1, text= "Please provide Data Type:",bg="white", justify = "right",pady =5 )

l1.grid(row = 1, column = 0, sticky= E )

e1 = Entry(frame1,bd = 2, width =50, textvariable = datatype )

e1.grid(row = 1, column = 1)

e1.focus_set()

l2 = Label(frame1,bg="white", text= "Please provide Data Convention:",justify = "right", pady = 5)

l2.grid(row = 2, column = 0,sticky= E)

e2 = Entry(frame1,bd = 2, width =50, textvariable = dataconvention )

e2.grid(row = 2, column = 1)

l3 = Label(frame1,bg="white", text= "Please provide Model Type:", justify = "right",pady = 5)

l3.grid(row = 3, column = 0,sticky= E)

################################################################


BIG阳
浏览 196回答 1
1回答

白猪掌柜的

Groove 是在 Tkinter 中定义的常量,由于您只从 Tkinter 导入不包含 Groove 的特定函数,因此您需要向其中添加 GROOVE 或添加import tkinter as tk然后设置救济= tk.GROOVE
随时随地看视频慕课网APP

相关分类

Python
我要回答