Message269883
@Terry I've removed the two string quotes changes in the latest patch.
@Berker I spent a small amount of time trying out your proposed super() changes, but could not get them to work on 3.5.1.
"C:\Users\John Hagen\AppData\Local\Programs\Python\Python35\python.exe" "C:/Users/John Hagen/PycharmProjects/test/test.py"
Traceback (most recent call last):
File "C:/Users/John Hagen/PycharmProjects/test/test.py", line 25, in <module>
app = Application(master=root)
File "C:/Users/John Hagen/PycharmProjects/test/test.py", line 6, in __init__
super().__init__(self, master)
File "C:\Users\John Hagen\AppData\Local\Programs\Python\Python35\lib\tkinter\__init__.py", line 2583, in __init__
Widget.__init__(self, master, 'frame', cnf, {}, extra)
File "C:\Users\John Hagen\AppData\Local\Programs\Python\Python35\lib\tkinter\__init__.py", line 2131, in __init__
BaseWidget._setup(self, master, cnf)
File "C:\Users\John Hagen\AppData\Local\Programs\Python\Python35\lib\tkinter\__init__.py", line 2109, in _setup
self.tk = master.tk
AttributeError: 'Application' object has no attribute 'tk'
--------------------
import tkinter as tk
class Application(tk.Frame):
def __init__(self, master=None):
super().__init__(self, master)
self.pack()
self.create_widgets()
def create_widgets(self):
self.hi_there = tk.Button(self)
self.hi_there["text"] = "Hello World\n(click me)"
self.hi_there["command"] = self.say_hi
self.hi_there.pack(side="top")
self.quit = tk.Button(self, text="QUIT", fg="red",
command=root.destroy)
self.quit.pack(side="bottom")
def say_hi(self):
print("hi there, everyone!")
root = tk.Tk()
app = Application(master=root)
app.mainloop() |
|
Date |
User |
Action |
Args |
2016-07-06 12:41:47 | John Hagen | set | recipients:
+ John Hagen, terry.reedy, SilentGhost, docs@python, berker.peksag |
2016-07-06 12:41:46 | John Hagen | set | messageid: <1467808906.95.0.448539576218.issue27455@psf.upfronthosting.co.za> |
2016-07-06 12:41:46 | John Hagen | link | issue27455 messages |
2016-07-06 12:41:46 | John Hagen | create | |
|