2017-01-10 9 views
0

Ich habe dieses Problem. wenn ich secretframe() schreibe bekomme ich eine leere box irgendwelche ideen um das zu beheben? Auch wie kann ich ein wenig Platz zwischen den 2 Frames setzen.
Ich bin neu zu Tkinter und alle Tipps werden gerne geschätzt.Geheime tkinter Widget?

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() 

Antwort

1

Sie haben die Klammern vergessen. Versuchen Sie:

sframe.grid() 
sLabel.grid()