노는게 제일 좋습니다.

tkinter modify widget option 본문

Python/기타 공부

tkinter modify widget option

노는게 제일 좋습니다. 2016. 9. 17. 17:28

Summary

Wrong: lbl.text = "PLUG"

Right : lbl.config(text = "PLUG")

 



You have code.

from tkinter import *

master = Tk()

lbl = Label(master, text="studioPLUG")
lbl.pack()


If you want to modify options of a widget ("studioPLUG" --> "PLUG") , you could see message like below.

 lbl.text = "PLUG"

>> Traceback (most recent call last):
  File "<pyshell#24>", line 1, in <module>
    lbl.text
AttributeError: 'Label' object has no attribute 'text'


In order to modify that, you should use config

 lbl.config(text = "PLUG")


Maybe, option is not attribute.. in interpreter's view.


'Python > 기타 공부' 카테고리의 다른 글

python random  (0) 2016.09.17
Tkinter Entry widget control text data  (0) 2016.09.04
Tkinter tutorial(link)  (0) 2016.09.04
Tkinter PhotoImage resize  (1) 2016.09.04
Tkinter How to use grid for PhotoImage  (0) 2016.09.04
Comments