Python Forum
[Tkinter] cannot type in textbox
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] cannot type in textbox
#1
Hello All,
I am new to Python and have found my first head scratcher. I expect to find a have stumbled into some rookie mistake.

The below code creates a texbox that I can enter text in, highlight, copy ...
if I un-comment the file dialog portion of code the text box will no longer accept keyboard entry.
I have replicated this in 3.7 using Idle and 3.6 using Thonny.

What am I missing, or doing wrong.

from tkinter import filedialog
from tkinter import *


#build form
frmMain = Tk()


Tb1 = Text(frmMain,bd=10,height=12)
Tb1.grid(row=0,column=0,padx=10,pady=10,sticky=W+E)



##frmMain.filename =  filedialog.askopenfilename(initialdir = "/",title = "Select file",filetypes = (("CSV files","*.csv"),("all files","*.*")))
##NameOfFile = frmMain.filename
##f = open(NameOfFile,"r")  

##f.close


frmMain.mainloop()
Reply
#2
The computer can only run one thing at a time, unless you specifically program it to do multiple things. Therefor, while the filedialog is running you can not do anything else until it has returned to the calling program.
Reply
#3
It is not clear to me how to correct this. Can anyone provide a basic example of using a file dialog as part of a larger form.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  recording textbox data into a variable paul18fr 4 363 Feb-19-2024, 09:30 PM
Last Post: Axel_Erfurt
  [Tkinter] Tkinter Textbox only showing one character Xylianth 1 2,142 Jan-29-2021, 02:59 AM
Last Post: Xylianth
  [Tkinter] Redirecting stdout to TextBox in realtime Gilush 2 9,767 Jun-06-2020, 11:05 AM
Last Post: deanhystad
  tkinter how to unselect text in textbox Battant 0 2,225 Feb-17-2020, 02:00 PM
Last Post: Battant
  GUI insert textbox value into a Class dimvord 0 2,221 Jul-04-2018, 06:49 PM
Last Post: dimvord

Forum Jump:

User Panel Messages

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