Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bug or my misunderstanding?
#1
Hi all, I am trying to get to grips with Python using Visual Studio 2017 on Windows 10 and have a problem that may be a bug in VS or my misunderstanding of an import concept.

If I use the following code (snippet) on the line "name =" I get the error that tkinter does not contain filedialog

import tkinter as TK
....
name = TK.filedialog.askopenfilename()


However, if I add one extra line as follows it now works fine, but I cannot see how the 2nd line added can effect the "name = " line that failed the first test

import tkinter as TK
from tkinter.filedialog import askopenfilename
....
name = TK.filedialog.askopenfilename()


Is this a problem with visual studio and Python or have a misunderstood the import directive

Thanks in advance
Reply


Messages In This Thread
Bug or my misunderstanding? - by MrSteveVee - Jan-04-2018, 02:13 PM
RE: Bug or my misunderstanding? - by metulburr - Jan-04-2018, 04:46 PM
RE: Bug or my misunderstanding? - by MrSteveVee - Jan-04-2018, 10:58 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Misunderstanding kwargs? Donovan 2 2,351 Aug-04-2020, 08:09 PM
Last Post: Donovan
  misunderstanding of format in print function Harvey 2 2,247 Oct-29-2019, 12:44 PM
Last Post: buran
  Simple list comprehension misunderstanding Mark17 3 2,642 Oct-10-2019, 07:00 PM
Last Post: buran
  Misunderstanding with the “if” statement and “not equal” scriptoghost 6 4,525 Jun-23-2017, 09:43 AM
Last Post: DeaD_EyE

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020