▶️ Watch Entire Tkinter Playlist ✅ Subscribe To My RUclips 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
I am loving the content, and honestly, I am learning a lot through your online mini-classes on RUclips. Honestly, can say that just from these videos, I am actually getting a huge foundation on python.
Last videos: Sorry for my typings, its friday in Vegas.... This video: its monday morning, u gotta bear with me... Haha, Im waiting for the next days ;) Good videos btw!! keep it up!
@@Codemycom , I am, I am.... need more time in a day hahaha... Im learning great things here! ... I was just building some gui stuff in pygame, but this is much easier!
Hi John. What code would be needed to show the records when there were more than what would fit in the window? I'm assuming you could place them in another window or frame with the ability to use a scroll button. Thanks!
@@markostanojevic4739 If you've followed the video 100% same way, then put it inside the delete method (as I originally mentioned in the comment). It's been over a year since I did this tutorial and now I am actually working with Angular / Typescript on a Web development job, so I don't remember every little detail.
Hi John, would you please let me know if there is a reason capitalization is used in the c.execute line of code on certain words? c.execute("DELETE from addresses WHERE oid =").
It's just how SQL has always been...not sure if it's the convention (ie what everyone does because it's easier to read) or if it's actually case sensitive. Try it lowercase and see what happens :-p
Is it possible to change the ID of a record? so if i wanted to add a specific record to appear at a specific part of the list rather than just showing on the bottom? ( I figure changing the ID is the easiest way to do this, if not, is there another way of making that happen?)
What could I do to update oids' when I delete a record? I mean, when there are 3 records and I'll delete the 2nd one, there will be 2 records with oid 1 and 3. I need to automatically update oids' to 1 and 2. Is there any easy way to implement it?
Thanks very much for these videos, definitely buying your course. Quick question though: I'm trying to do a similar sort of database app, but I want it such that whenever a new person is added, a tab for their name appears on the root window (Successfully done). When this tab (button) is clicked, all the other details about them (last name, address etc) should be displayed in a window. Also, when you initially start the app, tabs/buttons for all people created the last time the app was used are automatically created on the root window (successfully done). The problem I'm having is that when these buttons are clicked, they open the window with all the details for the last added person instead of for the person who's name is shown on the button. To create the buttons on the root window, I used a for loop which goes through all names within the database. For each name, it creates a button and adds it to row = n on the root window, before doing n=n+1, so that the next button is added to the row below. (All the buttons do come out in the correct places with the correct names). For the creation of each button, I am using: nameButton = tk.Button(root, text=current_name, command=lambda: accessUserData(current_name)) Where current_name is the string of the name of the person, and accessUserData is a separate function which displays all the other data about the person, given that you've provided the persons name as the argument. So for each cycle in the for loop which is creating the buttons, current_name is incrementally taking the value of each persons name within the database. I'm guessing my issue is that I've severely misunderstood how I should be mapping those assignments for each button in the for loop, but I can't figure out what I should be doing. I'm also suspecting this design I'm using would be frowned upon by those who practice good code, but really hoping you can help nonetheless!
To clarify, the aim of each button created should be to run 'accessUserData' with the input argument as the name which is shown on the button. But I need to make 100+ buttons, which all do this same function, just with different input arguments and labels on the button. So I tried using the for loop, but it's ended up being such that all 100 buttons, when clicked, execute the 'accessUserData' function with the input argument as the 100th button name instead of the name they should actually represent.
hello sir i am facing a problem all did is that i removed zipcode and and changed the text boxes and labels like the address to email and other stuff and i didnt make it only print the f_name and l_name I made it print all the information and then when i closed the app and returned after 2 hours they gave me this error: IndexError: tuple index out of range why what did i do wrong??
@15:12 When you delete the record and you say "It does some weird formatting". Is there any way when you delete a record for it to clear out that line completely.
The weird formatting is because the labels are being stuck one on another. And the weird formatting is because the old is still there. The right approach is not to make new labels through functions, but rather update an existing label with Label.config().
pyodbc.ProgrammingError: ('The SQL contains 0 parameter markers, but 1 parameters were supplied', 'HY000') A mistake appears to me when adding Please help
from tkinter import * import sqlite3 root = Tk() root.geometry("400x600") root.title("Verjaardagen van de familie") # create datbas or connect to one #conn = sqlite3.connect('scorelijst.db') #create cursor #c = conn.cursor() ''' # between six single quotes you neutralize CREATE TABLE curs.execute("""CREATE TABLE vjdagen ( vnaam text, vjdag, maand )""") ''' #create kies_naam functie def kies_naam(): # create datbas or connect to one conn = sqlite3.connect("Familie.db") #create cursor curs = conn.cursor() a = kies_naam_box.get() a = a.capitalize() curs.execute("SELECT * FROM vjdagen WHERE vnaam like '%{}%'".format(a)) #curs.execute("SELECT * FROM vjdagen WHERE maand like '%{}%'".format(a)) records = curs.fetchall() print_records = '' for record in records: print_records += str(record) + " " query_label = Label(root, text=print_records) query_label.grid(row=10, column=0, columnspan=2) conn.commit() conn.close() #create kies_maand functie def kies_maand(): # create datbas or connect to one conn = sqlite3.connect("Familie.db") #create cursor curs = conn.cursor() a = kies_maand_box.get() a = a.capitalize()
curs.execute("SELECT * FROM vjdagen WHERE maand like '%{}%'".format(a)) #curs.execute("SELECT * FROM vjdagen WHERE maand like '%{}%'".format(a)) records = curs.fetchall() print_records = '' for record in records: print_records += str(record) + " " query_label = Label(root, text=print_records) query_label.grid(row=13, column=0, columnspan=2) conn.commit() conn.close() #create submit function def submit(): # create datbas or connect to one conn = sqlite3.connect("Familie.db") #create cursor curs = conn.cursor() #insert into table conn.execute("INSERT INTO vjdagen VALUES (:vnaam,:vjdag,:maand)", { 'vnaam': vnaam.get(), 'vjdag': vjdag.get(), 'maand': maand.get() }) conn.commit() conn.close() #clear the invoerboxes vnaam.delete(0,END) vjdag.delete(0,END) maand.delete(0,END) #create Query function def query(): som = 0 #som2 = 0 # create datbas or connect to one # create datbas or connect to one conn = sqlite3.connect("Familie.db") #create cursor curs = conn.cursor() #Doorzoek de database curs.execute("SELECT *,oid FROM vjdagen") records = curs.fetchall() print_records = '' for record in records: print_records += str(record) + " " query_label = Label(root, text=print_records) query_label.grid(row=10, column=0, columnspan=2)
can you delete by name? for example, you make a variable called name,the user enters the name, and you can do c.execute("DELETE from adresses WHERE prodname="+name)
when I try to it, but not with oid with f_name it says no column c.execute("DELETE FROM addresses WHERE f_name="+delete_box.get()) the output shows "no such column as john" what to do master?
@@Codemycom I would like to have a small delete button next to each record, so the for loop must create them, but its not possible to add a button to a string. How to solve this problem?
@@Codemycom hello thank you for your answer, I dont understand how I can clear my output under delete record button, because my little program was slightly different, but the idea was i dont want to overwrite my output and i want "refresh" my label. I resolved this by creating a new window with output.
▶️ Watch Entire Tkinter Playlist ✅ Subscribe To My RUclips 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
I am loving the content, and honestly, I am learning a lot through your online mini-classes on RUclips. Honestly, can say that just from these videos, I am actually getting a huge foundation on python.
Great to hear!
Last videos: Sorry for my typings, its friday in Vegas.... This video: its monday morning, u gotta bear with me... Haha, Im waiting for the next days ;) Good videos btw!! keep it up!
Ha thanks bob...but this is video 21...there's like 45 more videos already published after this one. Check the playlist :-p
@@Codemycom , I am, I am.... need more time in a day hahaha... Im learning great things here! ... I was just building some gui stuff in pygame, but this is much easier!
Hi John. What code would be needed to show the records when there were more than what would fit in the window? I'm assuming you could place them in another window or frame with the ability to use a scroll button. Thanks!
15:12 I "fixed" the formatting issue by deleting the label widget when deleting the record.
query_label.grid_forget()
cool
thnx dude
can u please be precise, where di you put query_label.grid_forget(), because when i put it anywhere cmd says query_label is not defined...
@@markostanojevic4739 If you've followed the video 100% same way, then put it inside the delete method (as I originally mentioned in the comment).
It's been over a year since I did this tutorial and now I am actually working with Angular / Typescript on a Web development job, so I don't remember every little detail.
You are just amazing 🔥🔥🔥
Thanks!
Hi John, would you please let me know if there is a reason capitalization is used in the c.execute line of code on certain words? c.execute("DELETE from addresses WHERE oid =").
It's just how SQL has always been...not sure if it's the convention (ie what everyone does because it's easier to read) or if it's actually case sensitive. Try it lowercase and see what happens :-p
Is it possible to change the ID of a record? so if i wanted to add a specific record to appear at a specific part of the list rather than just showing on the bottom? ( I figure changing the ID is the easiest way to do this, if not, is there another way of making that happen?)
which software are you using for recording your screen and face(without background)
Record screen with OBS and face with camera and edit them together
Dear Sir
Thank you for the wonderful effort
You're welcome!
seems like getting crazy is adding tab :):)
Sorry, not sure what you mean
@@Codemycom nothing it's just that you said let's get crazy and then changed the code to add another tab if space between two things;)
Love you man
Ha, thanks!
What could I do to update oids' when I delete a record? I mean, when there are 3 records and I'll delete the 2nd one, there will be 2 records with oid 1 and 3. I need to automatically update oids' to 1 and 2. Is there any easy way to implement it?
Thanks very much for these videos, definitely buying your course. Quick question though: I'm trying to do a similar sort of database app, but I want it such that whenever a new person is added, a tab for their name appears on the root window (Successfully done). When this tab (button) is clicked, all the other details about them (last name, address etc) should be displayed in a window. Also, when you initially start the app, tabs/buttons for all people created the last time the app was used are automatically created on the root window (successfully done). The problem I'm having is that when these buttons are clicked, they open the window with all the details for the last added person instead of for the person who's name is shown on the button. To create the buttons on the root window, I used a for loop which goes through all names within the database. For each name, it creates a button and adds it to row = n on the root window, before doing n=n+1, so that the next button is added to the row below. (All the buttons do come out in the correct places with the correct names). For the creation of each button, I am using: nameButton = tk.Button(root, text=current_name, command=lambda: accessUserData(current_name)) Where current_name is the string of the name of the person, and accessUserData is a separate function which displays all the other data about the person, given that you've provided the persons name as the argument. So for each cycle in the for loop which is creating the buttons, current_name is incrementally taking the value of each persons name within the database. I'm guessing my issue is that I've severely misunderstood how I should be mapping those assignments for each button in the for loop, but I can't figure out what I should be doing. I'm also suspecting this design I'm using would be frowned upon by those who practice good code, but really hoping you can help nonetheless!
To clarify, the aim of each button created should be to run 'accessUserData' with the input argument as the name which is shown on the button. But I need to make 100+ buttons, which all do this same function, just with different input arguments and labels on the button. So I tried using the for loop, but it's ended up being such that all 100 buttons, when clicked, execute the 'accessUserData' function with the input argument as the 100th button name instead of the name they should actually represent.
Sorry Jim, I'm not able to help students with their projects that aren't a part of one of my courses.
Thank you John !
Sure thing!
hello sir i am facing a problem all did is that i removed zipcode and and changed the text boxes and labels like the address to email and other stuff
and i didnt make it only print the f_name and l_name I made it print all the information and then when i closed the app and returned after 2 hours they gave me this error:
IndexError: tuple index out of range
why what did i do wrong??
Really, thank you
Very welcome
Thanks Man
welcome!
@15:12 When you delete the record and you say "It does some weird formatting". Is there any way when you delete a record for it to clear out that line completely.
The weird formatting is because the labels are being stuck one on another. And the weird formatting is because the old is still there. The right approach is not to make new labels through functions, but rather update an existing label with Label.config().
@@melnimati this isn't working either
For some reason my program keeps freezing whenever I press the delete button to try and delete a record. Any idea why?
No clue...when you close your program after that happens...what does the terminal say?
Clear and nice
Thank you! See you around the channel!
i like ur intro
Thanks!
Is it works if the query inside execute are in small case..?
try it and see
pyodbc.ProgrammingError: ('The SQL contains 0 parameter markers, but 1 parameters were supplied', 'HY000')
A mistake appears to me when adding
Please help
Is there any way that I can select and delete a record from a Tree View and it will include deleting also the record from the sqlite3 database?
yes, doing that soon
Hi. Is it possible to delete a specific word(every time it will be another word ) instead of primaryKey, that is given from input in the box "delete"?
anything is possible
Amazing series on Tkinter 🔥 🔥
everything is working fine but there is some issue in my query label.
Can you provide the code of this video?
from tkinter import *
import sqlite3
root = Tk()
root.geometry("400x600")
root.title("Verjaardagen van de familie")
# create datbas or connect to one
#conn = sqlite3.connect('scorelijst.db')
#create cursor
#c = conn.cursor()
''' # between six single quotes you neutralize CREATE TABLE
curs.execute("""CREATE TABLE vjdagen (
vnaam text,
vjdag,
maand
)""")
'''
#create kies_naam functie
def kies_naam():
# create datbas or connect to one
conn = sqlite3.connect("Familie.db")
#create cursor
curs = conn.cursor()
a = kies_naam_box.get()
a = a.capitalize()
curs.execute("SELECT * FROM vjdagen WHERE vnaam like '%{}%'".format(a))
#curs.execute("SELECT * FROM vjdagen WHERE maand like '%{}%'".format(a))
records = curs.fetchall()
print_records = ''
for record in records:
print_records += str(record) + "
"
query_label = Label(root, text=print_records)
query_label.grid(row=10, column=0, columnspan=2)
conn.commit()
conn.close()
#create kies_maand functie
def kies_maand():
# create datbas or connect to one
conn = sqlite3.connect("Familie.db")
#create cursor
curs = conn.cursor()
a = kies_maand_box.get()
a = a.capitalize()
curs.execute("SELECT * FROM vjdagen WHERE maand like '%{}%'".format(a))
#curs.execute("SELECT * FROM vjdagen WHERE maand like '%{}%'".format(a))
records = curs.fetchall()
print_records = ''
for record in records:
print_records += str(record) + "
"
query_label = Label(root, text=print_records)
query_label.grid(row=13, column=0, columnspan=2)
conn.commit()
conn.close()
#create submit function
def submit():
# create datbas or connect to one
conn = sqlite3.connect("Familie.db")
#create cursor
curs = conn.cursor()
#insert into table
conn.execute("INSERT INTO vjdagen VALUES (:vnaam,:vjdag,:maand)",
{
'vnaam': vnaam.get(),
'vjdag': vjdag.get(),
'maand': maand.get()
})
conn.commit()
conn.close()
#clear the invoerboxes
vnaam.delete(0,END)
vjdag.delete(0,END)
maand.delete(0,END)
#create Query function
def query():
som = 0
#som2 = 0
# create datbas or connect to one
# create datbas or connect to one
conn = sqlite3.connect("Familie.db")
#create cursor
curs = conn.cursor()
#Doorzoek de database
curs.execute("SELECT *,oid FROM vjdagen")
records = curs.fetchall()
print_records = ''
for record in records:
print_records += str(record) + "
"
query_label = Label(root, text=print_records)
query_label.grid(row=10, column=0, columnspan=2)
print("--------------------------------------------------------")
conn.commit()
conn.close()
#create invoer_boxes
vnaam = Entry(root, width=30)
vnaam.grid(row=0, column=1, padx=20)
vjdag = Entry(root, width=30)
vjdag.grid(row=1, column=1, padx=20)
maand = Entry(root, width=30)
maand.grid(row=2, column=1, padx=20)
kies_naam_box = Entry(root, width=30)
kies_naam_box.grid(row=8, column=1)
kies_maand_box = Entry(root, width=30)
kies_maand_box.grid(row=11, column=1)
#create labels
vnaam_label=Label(root, text="Voornaam")
vnaam_label.grid(row=0,column=0)
vjdag_label=Label(root, text="Verj_dag")
vjdag_label.grid(row=1,column=0)
maand_label=Label(root, text="Maand")
maand_label.grid(row=2,column=0)
kies_naam_box_label=Label(root,text="Welke naam zoek je? : ")
kies_naam_box_label.grid(row=8, column=0)
kies_maand_box_label=Label(root,text="Welke maand zoek je? : ")
kies_maand_box_label.grid(row=11, column=0)
#creat Submit button
submit_btn = Button(root,text="Voeg record toe aan database", command=submit)
submit_btn.grid(row=6, column=0,columnspan=2,pady=10,padx=10,ipadx=100)
#Create Query Button
query_btn = Button(root, text="Toon records", command=query)
query_btn.grid(row=7, column=0, columnspan=2, pady=10, padx=10,ipadx=144)
naam_btn = Button(root, text="Wiens verjaardag wil je weten ?", command=kies_naam)
naam_btn.grid(row=9, column=0, columnspan=2,padx=2, pady=10,ipadx=97)
mnd_button = Button(root,text="Welke maand zoek je?", command=kies_maand)
mnd_button.grid(row=12, column=0, columnspan=2,padx=2, pady=10,ipadx=97)
root.mainloop()
or can you just give the whole code so i can try to fix it myself and thank you again you really are an amazing person
huh?
Can you give me the code for the database?
@@musakayasimp6456 Isn't it in the video?
@@Codemycom yes but i need it to compare so i need it for the comparing to be easier i need it as a file
@@musakayasimp6456 uh-huh... github.com/flatplanet/Intro-To-TKinter-RUclips-Course
can you delete by name? for example, you make a variable called name,the user enters the name, and you can do c.execute("DELETE from adresses WHERE prodname="+name)
yes, but what if more than one record has the same name?
@@Codemycom luckily I am doing it for an inventory management system, where each component has a unique name with a number attached to it.
Is it possible to make the same program by writing to a file, and then printing what's added?
sure
How do you use the .get() function to select a item to delete without it being a label but just as an item in the database?
.get() only works with certain widgets, like entry boxes. Retrieving items from the database doesn't involve get.
it give me sqlite3.OperationalError: no such table: addresses, i downloaded your code from Github! any Suggestions
I suggest not downloading the code from github, but following the video and doing it all yourself. You must have missed a step somewhere.
when I try to it, but not with oid with f_name it says no column
c.execute("DELETE FROM addresses WHERE f_name="+delete_box.get())
the output shows "no such column as john"
what to do master?
So you're doing it a different way than I do in the video and wondering why it doesn't work?
@@Codemycom I have the same problem as above, can you fix it? Thanks
@CHIA SHUN CHENG thanks! i was looking this
Pls hlp me sir. When i write:
c.execute("DELETE from shop WHERE S.No. =" + del_box.get())
It gives a syntax error near "=".
Pls hlp.
Use c.execute("DELETE FROM addresses WHERE = " +delete_box.get()). Just give a space after =, and it works.
what is "S.No."? looks like you have change every variable name. it might be it.
What's the different between padx pady and ipadx ipady
ipadx-y are internal, the other two are external padding
@@Codemycom Wow! Didn't expect a very fast reply! Thanks!
I am using mysql and that statement at 14:53 didn't work there. Please help me out!!
what does the error tell you to do?
@@Codemycom It tells me that i have an error in my SQL Syntax
@@pranavguptaa Then compare your SQL code to my video code and discover what you did wrong...
@@Codemycom Ok man,thanks for help
Actually I tried out with the same syntax but when I checked it out in the rdbms it is still showing the record which was apparently deleted!
then you didn't do something right...
share create video for Desktop application Master Detail form in Python - Like (Sales Order From , Purchase Order Form)
I have videos that cover that in the playlist
Hi, thank you very much for your video.
Thank you too
How can you select and show the record on a different window?
Check the playlist...I have videos on opening other windows.
te amo < 3
:-)
How to get a delete button next to each entry?
what's the question? Just do it...maybe keep watching videos in the playlist for basic grid stuff...
@@Codemycom I would like to have a small delete button next to each record, so the for loop must create them, but its not possible to add a button to a string. How to solve this problem?
it doesnt work why? the terminal shows no errors still the record is not deleted
Check your code for typos
how can i clear my output on label?
What do you mean?
@@Codemycom hello thank you for your answer, I dont understand how I can clear my output under delete record button, because my little program was slightly different, but the idea was i dont want to overwrite my output and i want "refresh" my label. I resolved this by creating a new window with output.
@@pietromarro4540 cool
@@Codemycom thank you for your videos!! now im working on my database and im making new windows with toplevel() , your video are very useful!!!
@@pietromarro4540 Awesome! Glad you're enjoying them!
Why I still error, appear "indentation error :unexpected indent , "{"
Python is tab specific. You have to use the tab key on your keyboard and it has to be exact.
my results didn't tab well... hmmm
bro , i wanna application to see my database pls
Yeah, that's what all this does
I always get this "_tkinter.TclError: bad screen distance "10 0"" :(
then you have a typo in your code somewhere
anyone else here for the comp sci IA for the IB?
:-)
What did I witness at 0:00 frame? Meme potential...
lol
Having the same UI how can we add, delete, update, things for a CSV sheet? @Codemy.com
I have a whole course on using python and excel at Codemy.com
"What happened in Vegas stays in Vegas "
For sure lol