This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author zaazbb
Recipients zaazbb
Date 2012-11-10.08:23:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1352535823.62.0.690631725764.issue16448@psf.upfronthosting.co.za>
In-reply-to
Content
when i use tkinter.font, i meet a error "'module' object has no attribute 'font'". if i add "import tkinter.font", it's no error.

but when i use tkinter,messagebox, it's no error without "import tkinter.messagebox".

and, under the tkinter folder, "messagebox.py" and "font.py" have the same hierarchical filesystem.

why they have different import method?

here is my code:
1)tkinter.font -- only use "import tkinter" meet a error, must add "import tkinter.font".code is below:

import tkinter
#import tkinter.font
root = tkinter.Tk()
ft = tkinter.font.Font(family = 'Fixdsys',size = 20,weight = tkinter.font.BOLD)
tkinter.Label(root,text = 'hello sticky',font = ft ).grid()
root.mainloop()

2)tkinter.messagebox -- only use "import tkinter" is all ok.code is below:

import tkinter
def callback():
    if tkinter.messagebox.askokcancel("Quit", "Do you really wish to quit?"):
        root.destroy()
root = tkinter.Tk()
root.protocol("WM_DELETE_WINDOW", callback)
root.mainloop()


i am a beginner on python. if have a reply, please email me. thanks.
History
Date User Action Args
2012-11-10 08:23:43zaazbbsetrecipients: + zaazbb
2012-11-10 08:23:43zaazbbsetmessageid: <1352535823.62.0.690631725764.issue16448@psf.upfronthosting.co.za>
2012-11-10 08:23:43zaazbblinkissue16448 messages
2012-11-10 08:23:43zaazbbcreate