▶️ Watch Entire Tkinter Playlist ✅ Subscribe To My TH-cam Channel: bit.ly/2UFLKgj bit.ly/2IGzvOR ▶️ See More At: ✅ Join My Facebook Group: Codemy.com bit.ly/2GFmOBz ▶️ Learn to Code at Codemy.com ✅ Buy a Codemy T-Shirt! Take $30 off with coupon code: youtube1 bit.ly/2VC9WUN ▶️ Get The Code bit.ly/3fLFQ8p
Greetings from the Netherlands in the EU (capital Amsterdam 👊🏻) Thank you so much for explaining everything. I really learn a lot from your TH-cam channel.
It is in fact a series everyone interested in Python and Tkinter should follow, I found it very informative! Thank you so much, you helped me a lot to start programming my first GUI!
@@Codemycom Codemy i have a question i am a beginner and i want to know if Tkinter is used every time in python or is there any other way to make general user interface without Tkinter
John how about not opening the file..but we have a dialogue box and we give them a word or code and it reads thru a folder with multiple pdfs and brings it back in on the screen relevant information say a line or two of the word or the code
Hey, is it possible to group data be a particular column and then display it? Fir example if multiple records have the the same value of one column, say the "Name" column, is it possible to add the first one to a parent and create a child which contains the rest of the data?
@@Codemycom Whenever possible, please do make a video on how to search dynamically a csv file using Treeview. Just like you did that Listboxes, thank you!
HELPP PLEASE !!!! i'm working on a project , the main page has upload button and search button , i uploaded the file like you did in the command of the upload button so when i press the button i get a new window with this video content , but when i close it the data is not saved , i want to use the search button to get information from the excel file uploaded in the content of the upload button . MY problem is i don't know how to save the data when i close the window , and how to make the search .
Is it possible to click on a record in Tree-View and clicking on it automatically fills in all the data from that record in the corresponding entry boxes available on the screen?
@@Codemycom Yeah i found that one! However, I am not able to figure out how to search dynamically using Treeview. I can perform search on nested lists from CSV files easily, but I want it to look dynamic so that it looks more pleasnig to the eye, like you did search on List Boxes, that kind of thing is possible on Treeview?
@@Codemycom alright, thank you for the help, I really appreciate it! Because of you I am able to build full stack GUI applications on Python for myself and my friends! :) I can't thank you enough
I have videos on grabbing data from sqlite already...and now you know how to insert into treeview from this and the last few videos...you should have what you need...
I skipped the try, and added a dictionary manually, just to test the treeview, and it worked fine. so, yes... after 12 years of experience in python, I still hate numpy and pandas. I always end having to make everything on my own.
My except error code is not being run after an exception. If I run file_open(): I get the open file window, but if I close it without choosing a file I get the FileNotFoundError. Then my program freezes up and I can no longer open a file due to locked database. It never executes what is inside the except error code. Added the print to see if there was something wrong with my label, and it never showed up. I also added text to the label where it was created and it did show up. if filename: try: filename = r"{}".format(filename) df = pd.read_excel(filename, header= None)
except FileNotFoundError: print('Did This Work?') my_label.config(text="File could not be Opened")
except ValueError: my_label.config(text="File could not be Opened")
Can anyone tell me how to keep this treeview window dynamic!! For Ex : If the content changes in .CSV file, it should automatically update in treeview window.. Please guide
@@Codemycom i have watched and rewatched the video and from what i can tell.. nothing. Thanks for incredibly fast response! heres my "treeview section" if that helps: #setup new treeview my_tree["column"] = list(df.columns) my_tree["show"] = "headings" #loop through column list for headers for column in my_tree["column"]: my_tree.heading(column, text=column) #put data in treeview df_rows = df.to_numpy().tolist() for row in df_rows: my_tree.insert("", "end", values=row) #pack treeview my_tree.pack()
The Tkinter textbox i doing some weird stuff, whenever I m working with the text widget and press (Control+i, Control+h, Control+k), it start doing weird stuff like:- Control+i - is deleting all the selected text (the text under selection tag). Control+h - is working somewhat like a Backspace key. Control-k - removes all the text at the right side to the position of cursor. Do you know some trick to fix that? Like it's messing up the things if i wanna bind some event or function with these key combinations, like I wanna use Control-Key-I for Italics function
@@Codemycom NO, I even tried writing a new code from tkinter import * root=Tk() t =Text(root, width=50, height=50) t.pack() still it does the same thing as I mentioned earlier.
Yeah, I'm struggling with this. I copied your direct code from Github and amended the initial directory and deleted the icon line. I'm given the Value Error message from the Exception handling code that was entered. And this (I shortened the file directories): Exception in Tkinter callback Traceback (most recent call last): File "C:\...\Python39\lib\tkinter\__init__.py", line 1892, in __call__ return self.func(*args) File "C:\...\File.py", line 36, in file_open my_tree["column"] = list(df.columns) UnboundLocalError: local variable 'df' referenced before assignment I'd love to get this working. Any ideas? Cheers
I'd never copy paste code from github, it can lead to all sorts of errors. You have a program flow problem, it's telling you what it is. You are referencing the variable df before you are assigning anything to it.
Thanks for replying. Following the code through, I assume the reason it references the df variable before it is assigned is because the df variable is created inside the "try" statement. I'm strugging on why a ValueError Exception would be raised in the first place rather than the try statement being run. I've tried a couple of xlsx files. I'll have a Google.
So I just tried reading an excel file using:: df = pd.read_excel and that didn't work, but I got a different Error message which was more helpful; it turns out I just needed to install openpyxl. Now I feel silly. That's what I get for jumping into te middle of a course. All sorted. Cheers
@@stegabilly Man, I am very stuck here. I'm getting the same errors you were getting. All you had to do was install openpyxl? That didn't fix my problem.
i've tried to delete try/except blocks because i've had in my app ValueError message which we designed in our app, and run the file without them (only with code form try block) and than i had different error: ValueError: Your version of xlrd is 2.0.1. In xlrd >= 2.0, only the xls format is supported. Install openpyxl instead. I've changed the excel files to .xls and everything works fine
Hello Sir, I tried this code but the filemenu was not added somehow so i cannot see the menu to open the file also there is no error i cannot understand what should i do
@@CodemycomI checked for the typos many times but the file_menu.add_command(label="Open", command=file_open) is not working which is why there is no Open menu when i checked and also no error is being shown
Hello sir, I have an question about django related quries sir "how to insert multiple images in carousal using django" i request you plz give me an answer its very important
Traceback (most recent call last): File "c:\Users\MAA\OneDrive\Desktop\WaySoul\pract.py", line 148, in file_menu.add_command(Lable="Open",command=file_open) File "C:\Users\MAA\AppData\Local\Programs\Python\Python39\lib\tkinter\__init__.py", line 3302, in add_command self.add('command', cnf or kw) File "C:\Users\MAA\AppData\Local\Programs\Python\Python39\lib\tkinter\__init__.py", line 3289, in add self.tk.call((self._w, 'add', itemType) + _tkinter.TclError: unknown option "-Lable"
▶️ Watch Entire Tkinter Playlist ✅ Subscribe To My TH-cam Channel:
bit.ly/2UFLKgj bit.ly/2IGzvOR
▶️ See More At: ✅ Join My Facebook Group:
Codemy.com bit.ly/2GFmOBz
▶️ Learn to Code at Codemy.com ✅ Buy a Codemy T-Shirt!
Take $30 off with coupon code: youtube1 bit.ly/2VC9WUN
▶️ Get The Code
bit.ly/3fLFQ8p
Greetings from the Netherlands in the EU (capital Amsterdam 👊🏻)
Thank you so much for explaining everything.
I really learn a lot from your TH-cam channel.
Happy to hear it!
Your Python Tkinter Playlist is really helping the students and I'm one of them 😅😅😅
Thanks a lot Sir !
Glad you're enjoying it!
It is in fact a series everyone interested in Python and Tkinter should follow, I found it very informative! Thank you so much, you helped me a lot to start programming my first GUI!
Happy to hear it!
Explaining the each and every line of program clearly..Thank you so much Sir...
So nice of you
Great tutorial. I actually applied this to my vehicle inventory query app and added vertical and horizontal scrollbars. Thank you.
Nice
I'm making a POS software and your videos are helping me a lot.
Glad to hear it!
Smash that like button guys n gals! its free! great python tkinter tutorial, Codemy. Thanks
Greetings from Poland John 👏
Hello there!
Thank you SO MUCH for this tutorial, I have been looking for one of these for a while now
Glad you like it!
@@Codemycom Codemy i have a question i am a beginner and i want to know if Tkinter is used every time in python or is there any other way to make general user interface without Tkinter
@@brijesh7146 There are many different tools to make GUI stuff with Python, not just tkinter
Thank You for the video. ❤❤❤
Welcome!
Great video. Very informative and well explained
Thanks!
Thanks you sir for this amazing tutorials ...helped me a lot in my project 🙏
Glad it helped!
John how about not opening the file..but we have a dialogue box and we give them a word or code and it reads thru a folder with multiple pdfs and brings it back in on the screen relevant information say a line or two of the word or the code
thank you Mr Elder for this cool contents 👍
You're very welcome! Thanks for watching!
NIce i have been watchin all ur vids recently
Nice!
is there a way to automatically adjust the column width depending on the width of the text in the columns? How could be done this?
Hey, is it possible to group data be a particular column and then display it?
Fir example if multiple records have the the same value of one column, say the "Name" column, is it possible to add the first one to a parent and create a child which contains the rest of the data?
Sure probably
@@Codemycom Whenever possible, please do make a video on how to search dynamically a csv file using Treeview. Just like you did that Listboxes, thank you!
Hi sir, how about open a specific sheet for example is I only want to show to my treeview the sheet 2 in excel?
Is it possible to show up specific rows and columns from a DataFrame on the Treeview?
Hoping you can give me a hand?
Is it possible to open only selected columns from a spreadsheet instead of the entire sheet?
Sure, I have a whole course on using excel and python at codemy.com
@@Codemycom Thanks! I figures it out, used csv reader and iterated through the columns I wanted
HELPP PLEASE !!!! i'm working on a project , the main page has upload button and search button , i uploaded the file like you did in the command of the upload button so when i press the button i get a new window with this video content , but when i close it the data is not saved , i want to use the search button to get information from the excel file uploaded in the content of the upload button . MY problem is i don't know how to save the data when i close the window , and how to make the search .
John, is it possible to do a delete columns function that works with the spreadsheet we see in the Treeview ?
If so, could you do a video on the subject ?
Is it possible to click on a record in Tree-View and clicking on it automatically fills in all the data from that record in the corresponding entry boxes available on the screen?
Yeah, I have a video on that in the playlist that I'm doing right now (the last few videos, most recent).
@@Codemycom Yeah i found that one! However, I am not able to figure out how to search dynamically using Treeview. I can perform search on nested lists from CSV files easily, but I want it to look dynamic so that it looks more pleasnig to the eye, like you did search on List Boxes, that kind of thing is possible on Treeview?
@@devenjain7116 Sure but I don't have videos on it. Maybe I'll make one
@@Codemycom alright, thank you for the help, I really appreciate it! Because of you I am able to build full stack GUI applications on Python for myself and my friends! :)
I can't thank you enough
@siddanna arakeri no thanks
Hi Teacher, Am John from Kenya. Kindly create a video on how to print tkinter treeview data. Am trying it but it's printing blank page. Thanks.
Sir, how can I align the values in the center of the column?
Thanks !! the video is perfect !
Glad you liked it!
Great video John. Could you possibly do a video regarding taking an sql database and slapping it onto a treeview?
I have videos on grabbing data from sqlite already...and now you know how to insert into treeview from this and the last few videos...you should have what you need...
thanks... however, pyinstaller is having issues with pandas.
I did everything but it gives me the error "file not found".
Maybe something is missing between the lines "filename = ..." and "pd.read_excel()..." ?
I skipped the try, and added a dictionary manually, just to test the treeview, and it worked fine.
so, yes... after 12 years of experience in python, I still hate numpy and pandas. I always end having to make everything on my own.
Thank you for the tutorial. One thing that bothered me was the .filetype command. I tkinter is using .filetypes in the current version instead.
Sorry, no clue what you're talking about
My except error code is not being run after an exception. If I run file_open(): I get the open file window, but if I close it without choosing a file I get the FileNotFoundError. Then my program freezes up and I can no longer open a file due to locked database. It never executes what is inside the except error code. Added the print to see if there was something wrong with my label, and it never showed up. I also added text to the label where it was created and it did show up.
if filename:
try:
filename = r"{}".format(filename)
df = pd.read_excel(filename, header= None)
except FileNotFoundError:
print('Did This Work?')
my_label.config(text="File could not be Opened")
except ValueError:
my_label.config(text="File could not be Opened")
Can anyone tell me how to keep this treeview window dynamic!!
For Ex : If the content changes in .CSV file, it should automatically update in treeview window..
Please guide
How to add search field in this, which works dynamically filtered with data ? Thanks in advance
I have videos on search on the playlist
awesome!!!
Thanks!
Thanks a lot man
Sure thing!
I get " NameError: name ´df´ is not defined" in:
my_tree["column"] = list(df.columns)
what could be the reason?
what did you do differently from the video?
@@Codemycom i have watched and rewatched the video and from what i can tell.. nothing. Thanks for incredibly fast response!
heres my "treeview section" if that helps:
#setup new treeview
my_tree["column"] = list(df.columns)
my_tree["show"] = "headings"
#loop through column list for headers
for column in my_tree["column"]:
my_tree.heading(column, text=column)
#put data in treeview
df_rows = df.to_numpy().tolist()
for row in df_rows:
my_tree.insert("", "end", values=row)
#pack treeview
my_tree.pack()
fixed it.. stupid mistakes
The Tkinter textbox i doing some weird stuff, whenever I m working with the text widget and press (Control+i, Control+h, Control+k), it start doing weird stuff like:-
Control+i - is deleting all the selected text (the text under selection tag).
Control+h - is working somewhat like a Backspace key.
Control-k - removes all the text at the right side to the position of cursor.
Do you know some trick to fix that? Like it's messing up the things if i wanna bind some event or function with these key combinations, like I wanna use Control-Key-I for Italics function
No clue...mine doesn't do that. Did you code it to do that?
@@Codemycom NO, I even tried writing a new code
from tkinter import *
root=Tk()
t =Text(root, width=50, height=50)
t.pack()
still it does the same thing as I mentioned earlier.
@@Vibhu__Khullar Weird
Sir can you please make a video to add scrollbars to browse excel file in tree view.
I have plenty of videos on scrollbars with treeview...but you don't ever put excel files in a treeview. That's not what treeview does.
Yeah, I'm struggling with this. I copied your direct code from Github and amended the initial directory and deleted the icon line. I'm given the Value Error message from the Exception handling code that was entered. And this (I shortened the file directories):
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\...\Python39\lib\tkinter\__init__.py", line 1892, in __call__
return self.func(*args)
File "C:\...\File.py", line 36, in file_open
my_tree["column"] = list(df.columns)
UnboundLocalError: local variable 'df' referenced before assignment
I'd love to get this working. Any ideas? Cheers
I'd never copy paste code from github, it can lead to all sorts of errors. You have a program flow problem, it's telling you what it is. You are referencing the variable df before you are assigning anything to it.
Thanks for replying. Following the code through, I assume the reason it references the df variable before it is assigned is because the df variable is created inside the "try" statement. I'm strugging on why a ValueError Exception would be raised in the first place rather than the try statement being run. I've tried a couple of xlsx files. I'll have a Google.
So I just tried reading an excel file using:: df = pd.read_excel
and that didn't work, but I got a different Error message which was more helpful; it turns out I just needed to install openpyxl. Now I feel silly. That's what I get for jumping into te middle of a course. All sorted. Cheers
@@stegabilly Man, I am very stuck here. I'm getting the same errors you were getting.
All you had to do was install openpyxl? That didn't fix my problem.
It is possible with csv file ?
of course
Gracias señor
You're welcome!
Sir how do we fix the width in the case of importing excel file?
Not sure what you mean
@@Codemycom Sir, when we put data in treeview, can we preset the column width?
sorry sir, i can't know it
my_tree["column"] = list(df.columns)
Unbound Local Error: local variable 'df' referenced before assignment
I have that same error, even when I copied code from John's GitHub
i've tried to delete try/except blocks because i've had in my app ValueError message which we designed in our app, and run the file without them (only with code form try block) and than i had different error: ValueError: Your version of xlrd is 2.0.1. In xlrd >= 2.0, only the xls format is supported. Install openpyxl instead. I've changed the excel files to .xls and everything works fine
Hello Sir, I tried this code but the filemenu was not added somehow so i cannot see the menu to open the file also there is no error i cannot understand what should i do
Check your code for typos...it has to be exact.
@@CodemycomI checked for the typos many times but the file_menu.add_command(label="Open", command=file_open) is not working which is why there is no Open menu when i checked and also no error is being shown
@@shrutimishra5497 Things don't just "not work". They don't work because you wrote the code wrong somewhere.
@@Codemycom Thank You Sir, I wrote the Menu code again and it worked.
@@shrutimishra5497 Awesome! Glad you got it sorted out.
Sir,
I want to ask that can we convert .py file to .apk file or not?
no you can't
Hello sir,
I have an question about django related quries sir "how to insert multiple images in carousal using django" i request you plz give me an answer its very important
this is a tkinter video
@@Codemycom yes sir i know but i have done only for fast reply
I have completed a blog project from your tutorial and learns lots of things
Could be done anything for my question
@@Wittytime98 It's not something I can explain in a comment here
There are not shown more than 1600 rows in treeview table. Need to show more than 5000 rows. pls make a tutorial in this regard.
sir CSV file is not opening with it
Great.
Thanks!
how should fix this error >>>> ModuleNotFoundError: No module named '_typeshed'
stackoverflow.com/questions/61532337/python-modulenotfounderror-no-module-named
Way to open a file? I just use the string returned from filedialog, rather than converting it to a string.
how to Open Exel Spreadsheet in Grid ?
in grid?
No big boooom today😔
Ha
Traceback (most recent call last):
File "c:\Users\MAA\OneDrive\Desktop\WaySoul\pract.py", line 148, in
file_menu.add_command(Lable="Open",command=file_open)
File "C:\Users\MAA\AppData\Local\Programs\Python\Python39\lib\tkinter\__init__.py", line 3302, in add_command
self.add('command', cnf or kw)
File "C:\Users\MAA\AppData\Local\Programs\Python\Python39\lib\tkinter\__init__.py", line 3289, in add
self.tk.call((self._w, 'add', itemType) +
_tkinter.TclError: unknown option "-Lable"
why this error show on code
@@abdulmugees2787 lable should be lowercase, always.
@@Codemycom thanks sir
@@abdulmugees2787 welcome