秘密tkinter小部件?

时间:2017-01-10 20:03:33

标签: python tkinter

我遇到了这个问题。当我写secretframe()时,我得到一个空框,任何想法来解决这个问题?另外,如何在2帧之间留出一点空间 我是tkinter的新手,很高兴收到任何提示。

import tkinter as tk
import time
import math
##----------Functions
root = tk.Tk()
def Pi():
    pi = math.pi
    x = list(str(pi))
    map(int,x)
    print(math.pi)
def Unfinished():
    print("This Button is not finished")

def secretframe(frame):
    secrett = tk.Toplevel()
    sframe = tk.Frame(secrett, height="300", width="300", bg="PeachPuff")
    sLabel = tk.Label(sframe, text="Secret")
    sframe.grid
    sLabel.grid


##Defining
##Frames
frame = tk.Frame(root, height="300", width="300", bg="Black")
Mframe = tk.Frame(root, height="300", width="300", bg="White")
##WIdgets
Label = tk.Label(frame, text="R1p windows", bg="Black", fg="White")
Label2 = tk.Label(Mframe, text="Math magic", bg="White", fg="Black")
Knapp = tk.Button(frame, text="ok(ADMIN)", fg="White", bg="Black", font="monospace")
PIKnapp = tk.Button(Mframe, text="Pi(WIP)(UNFINISHED)", bg="White", fg="Black", font="Times")


##Config and bindings
Knapp.config(command=Unfinished)
PIKnapp.config(command=Pi)

##Packing
##  Frame 1
Label.grid()
frame.grid()
Knapp.grid()
##  Frame 2
Label2.grid()
Mframe.grid()
PIKnapp.grid()

1 个答案:

答案 0 :(得分:1)

你忘了括号。尝试:

sframe.grid ()
sLabel.grid ()