1
프레임이있는 GUI 프로그램을 페이지마다 이동하고 메서드 만 사용하는 동안 작동시키지 만 클래스를 도입하자마자 다음과 같이 나타납니다 오류 :Python Tkinter : TypeError : '프레임'객체를 호출 할 수 없습니다.
TypeError: 'Frame' object is not callable
다음과 내가 사용하고 코드가 될 때 :
import sys
from tkinter import *
from tkinter import ttk
class teachingContent(Tk):
def __init__(self):
super(teachingContent, self).__init__()
self.first_title_frame = ttk.Frame()
self.first_frame = ttk.Frame()
def nextButtonPressed(self):
pass
def prevButtonPressed(self):
pass
def formSize(self):
self.geometry("650x450+200+200") # Sets the size of the gui
self.title("Python Tutor")
self.nbutton = Button(text = "Next", command = self.nextButtonPressed).place(x=561,y=418)
self.pbutton = Button(text = "Previous", command = self.prevButtonPressed).place(x=0,y=418)
title_height = 40
self.first_title_frame(self, height=title_height, bg = 'black')
self.first_title_frame['borderwidth'] = 2
self.first_title_frame.grid(column=0, row=0, padx=35, pady=5, sticky=(W, N, E))
self.first_frame(self, bg = 'DarkSlateGray4')
self.first_frame['borderwidth'] = 2
self.first_frame['relief'] = 'sunken'
self.first_frame.grid(column=0, row=0, padx=33, pady=50, sticky=(W, N, E))
self.label = Label(self.first_title_frame, text = "Welcome to the Tutor").pack()
self.label = Label(self.first_frame, text = "Welcome to the Python Tutor. In this program you will learn to tools and techniques need to use Python.")
self.label.grid(column=0, row=0, ipadx=85,pady=11, padx=11, sticky=(N))
tc = teachingContent()
tc.formSize()
내가 다음과 같이 .configure
을 추가하는이 라인의 코드로 변경 한 :
self.first_title_frame.configure(self, height=title_height, bg = 'black')
그러나 이것은 나에게 다음 역 추적을 제공합니다
Traceback (most recent call last):
File "C:\Users\Tete De Bite\Dropbox\Year3\FinalYearProject\pythonTutoringSystem\debug.py", line 47, in <module>
tc.formSize()
File "C:\Users\Tete De Bite\Dropbox\Year3\FinalYearProject\pythonTutoringSystem\debug.py", line 31, in formSize
self.first_title_frame.configure(self, height=title_height, bg = 'black')
File "C:\Python33\lib\tkinter\__init__.py", line 1263, in configure
return self._configure('configure', cnf, kw)
File "C:\Python33\lib\tkinter\__init__.py", line 1254, in _configure
self.tk.call(_flatten((self._w, cmd)) + self._options(cnf))
_tkinter.TclError: unknown option "-pady"
사람이 내가 만드는 중이라서 프로그래밍 실수를 수정합니다 어떤 아이디어가 있습니까?
좋아요. 자기를 지우려고했는데 정확히 똑같은 오류가납니다. – Tumbler
여전히 '알 수없는 옵션'- 아디 "또는 다른 것을 말하고 있습니까? – Kevin
'bg '는 ttk 프레임의 유효한 속성이 아니기 때문에'unknown 옵션 "-bg"' – Tumbler