Building Out The GUI for our Database App - Python Tkinter GUI Tutorial #20
Vložit
- čas přidán 9. 05. 2019
- Building Out The GUI for our Database App. In this video we'll begin to build out the graphical user interface (GUI) for our database app with Tkinter. We'll add input boxes and buttons to add data to our database, and retrieve that data and output it onto the screen.
In this series I'll show you how to create graphical user interfaces for Python with Tkinter.
✅ Watch The Other Videos In This Python Playlist:
bit.ly/2UFLKgj
▶️ See More At:
Codemy.com
✅ Join My Facebook Group:
bit.ly/2GFmOBz
✅ Subscribe To My CZcams Channel:
bit.ly/2IGzvOR
▶️ Learn to Code at Codemy.com
Take $22 off with coupon code: youtube
▶️ Watch Entire Tkinter Playlist ✅ Subscribe To My CZcams 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
Sorry, Could I ask how I can fix the error of sqlite3.OperationError: no such table: address
@@user-rs2yx6zc8q rewatch the video and follow the directions exactly.
@@user-rs2yx6zc8q i can help you
@@wailsari6237 bro i m facing the same issue
@@lakshayahlawat6674 same
Great video, this is exactly what I was looking for. There is 1 thing I would like to do different that I'm unsure how to do.
I would like to enter a oid into a text box, use the query button to look through the table for that oid, and populate the other input fields ( f_name, Zip, ect....). With the data that associated the the oid.
Just what I've been looking for. Thanks!
It's amazing! Just what I'm looking for for days! Thank you sooo much, man! Keep doing it, you are great!
Thanks, will do!
Sometimes I wish I wasn't broke just to support amazing teachers like these
Ha! Appreciate the thought!
thanks for lessons good and clear
Thanks man you make this stuff easy to understand for sure.
Thanks! Glad you're enjoying it.
This channel is helpful for me cause this is the solution for my error in my thesis app. Thankyou😄
Awesome
Thank you so much!!! love your videos !
You're very welcome!
Very Useful Lesson. Thanks.
Thank you so much for this video, I have learnt a lot from this video!
Glad you enjoyed it!
Great information, just what I needed. You are a great teacher! Please keep it up!
Thanks! I will!
Really Very Helpful Video. Thank.
Object identifiers (OIDs) are used internally by SQLite as primary keys for various system tables. Also, an OID system column is added to user-created tables. Type oid represents an object identifier.
Thank you! This helped me out a lot with a work project! Subbed :)
Glad to hear it!
Proud owner of lifetime membership, keep up the good work! 👍👍
Awesome, enjoy!
John, thank you for all of your great learning material provided at zero cost here on youtube. Beautiful content and amazing results. Hope its a good day in Vegas. Have a good day!
Welcome!
Thank you a lot, this is very helpful !
Glad it was helpful!
Thanks for this video. I have created a small database app to keep and manipulate golf scores and wanted a GUI front end. Plenty of stuff found about creating pretty screens and placing buttons etc but none that connect the GUI to the working program. Really good thanks. I shall be watching a lot more.
Glad it helped!
I like the way you teach it's really helpful for me
Glad you like it!
man love your videos
could please do a series on djnago!!!!
THANKS
Ya that's one is a headache
excellent resource!!
this guy has taught me more about data science than all four of my college professors this semester
Ha, happy to hear it!
Hi. Great tutorial. I would like to point out that at 20:30 where you create the variable "print_records" in the for loop,we actually don't need it. You can write the for loop like this:
for record in records:
print(record[0])
It will workout exactly how you want it to without printing the first record twice.
yep
Is there a difference aside from syntax? Maybe like performance or memory size? Would like to know
Such a simple solution to my problem revealed in this video. I could not figure out how to pick between single pieces of data once they had been queried and fetched. Every time I treated the result as an item from a list or a tuple I could not seem to move through them correctly. I did not notice that it was actually both a list and a tuple.
:-)
You are a life saver.
Glad you found what you needed!
Love you sir....😍😍
You solved a lot of my problems...thank you
Glad to help!
Thank you for this video. It's very clear . Chapeau! I subscribe to your chanel. Thank you again.
Glad you liked it!
Excellent video, subscribed
Thanks!
Best Course ever on tkinter
Thanks!
loving your videos massively...pls will appreciate if you continue your flask training series and also wont mind if you can do a videos series on pygame, i also notice you dont have that on your website..thanks bro
Planning on both...
Hi, thank you very much for your video.
Thank you too
I got it to work...my dumb mistake. Thank you for an awesome video...
Those of you having problems with entering records to the table, try triple quotes around the INSERT INTO addressess function instead of single quotes.
i have tried this but its still saying "( "was not closed
Doesn't work, any other suggestions?
@@user-xo9fh2jb9x Not sure if this will help or if I am too late, but I just put a comma after zipcode.get() and that seemed to solve the problem
Thanks for this video.
You're welcome
Hello John...excellent tutorial..
Thanks!
*Thanks! Mr. White!*
Ha
Hello John,
I am a psychlogist and I collect data from large groups of students. Such as names, scores on various subjects, testscores, etc, etc. I am playing now with your program, using only first name and all kinds of scores. After that I use statistics to calculate sums per category, as well as standard deviation, percentile scores. So, this all means that I can benefit enormously from your basic database program. Thank you very much!!! :) Paul
Very cool Paul!
@@Codemycom Saint John II 🙂
@@Lennardish :-p
U are very good my friend
Thanks!
thank you very much
You are welcome
Thank you for the video !
However , I am having an issue putting the below SQL query into Python :
insert into GERVERSION values (10, 'xxxxxxxx', 7, 4, 2, getdate(),'')
Note that in SQL , I have timestamp for the getdate() part
Can you please help me out with the right syntax to put this into work ?
NO WE WON'T HELP!
Excelente!!
Thanks!
Thanks a lot
Most welcome
Thank you sir
You're welcome!
In this example, being the names of fields in the table first_name, last_name, city, etc., along the video is used for some fields a reduced name f_name, l_name, whereas for other fields its complete / unmodified name is used: city, zipcode and so on. I ask: could be used always the full name or always a reduced / modified name: s_first_name, s_city, s_zipcode, etc. for every field and in any case, for instance: s_f_name = s_f_name.get() ? Thank you.
Hello John, excellent video! I have a little problem.. When I enter a zip code that starts with a 0(zero), the record does not return the 0. Any feedback would be appreciated. Thank You
Hi John. Really good tutorial! One question - regarding the need to comment out the 'create table' code after it has been run once since the table has been created. How would you go about doing this if you made a program that was to be run by the public. Would you make an if statement to check if the table already exist and only create a table if it doesn't? Thanks heaps!
Yeah I'd probably do that
Such an amazing video it really helped me a lot with my project thank you! Having only 1 problem at the moment where the strings entered in the boxes are being added to the database and printing as u'string' instead of just the string. How can I fix this?
Not sure what's going on
Do str() and put in parenthesis
very good
Thanks!
Thank you for this video. I have a question. In the query function, when selecting from thr database, you wrote 'FROM addresses and my question is where did you get the addresses?
I named that in a previous video...check the playlist
Thanks Mr White
lol
I'm setting a data entry GUI, and following these videos for help. How do I set a table value if a certain criteria is met? For instance, I have a column in my table called Average, and on my form I have a checkbox allowing the user to include the entered data into the average (if it's checked then its included in average). So when inserting the values into the database, if the checkbox is checked I want it to insert "X" into the table, but if it is unchecked, I want it to be blank. Thank you so much for the help.
Use an if statement in your code.
Was checking out Python as a new language to learn.
Is this the most efficient way available to create a GUI? Using a text editor?
Isn't there an Integrated Development Environment (IDE) lsimilar to MS Visual Studio where you drag fields, text boxes, labels, buttons onto screen and then change appearance, align automatically , etc??
There are several ways to do GUI's with Python. I like this one the best. There are drag and drop IDE's out there, but you still have to write the code on the backend.
You my friend get a like and sub. Thank you for very useful vidoes
Thanks!
Thanks a lot u r my last hope
welcome
Thanks a lot for this! Your videos are extremely helpful.
I do have a question, is it possible for me to make a drop-down menu with options that can open up a new window? It's for a school project.
Thanks!
Of course. I have videos on opening new windows. Use that code in a function that gets called when you click a dropdown (using bindings - I have a video on dependent drop downs that will show you how to bind a dropdown to run a function).
@@Codemycom Oh thank you so much. I will make sure to check them out!
can we make this project with for loops in order to make the entries and the labels, i had some issues with that . any helps will be appreciated
Sure...check the playlist...I have a video on that
Could you use for loops to create an array of widgets in order to prevent so much reused code?
sure
I am getting the following error when trying to insert into the database - ('The SQL contains 0 parameter markers, but 1 parameters were supplied', 'HY000'). Can you please help me resolve this?
lol. i got an error. then, after a few minutes, it took me some time to realize that the name of the database is different from the previous video. anyway, works like a charm
Glad you got it sorted out
any video for you to linked tow table in sqlite3 with tkinter ? and thanks for all that knowlege
Sure, check the playlist
John goes: "So we add this variable here, go up here, create a function, then we pass this into the string, go over here place the label, name this text box, enter the database and BOOM"
Me: "Okey.... he said something about boom, where do I find boomy-thingy?!"
😂😂😂
Great videos man, just the playlist I've been looking for. 👍
ha
what linter are you using? I don't' get that much of highlights in my vscode
None...just default sublime text
Thanks a lot, A question, is this "Tutorial#20" in sequence ?
Yes
is there Date/Time type of column in table? how to work with it if i need extract for example 2 dates and times and calculate period between them, in days, hours, minuts etc.
I have videos on dates and times somewhere in the playlist.
Hi john, for some reason after we create the query function, the returned values look like strings, not nicely formatted with no ()'s and ""' s, any help would be great
Without seeing your code, I couldn't guess...you must have done something weird tho :-p
@@Codemycom thanks for the quick reply, I had to continue formatting sir! But I guess I do have another question, is there a way to bring the oid to the beginning of the string, as opposed to the end? thanks man!
Not sure what you mean
7:36 You could've placed each label in a list and iterated through each one and clear it with a for loop
Would it work if i made an input for a user which would be str and then insert this input into c.execute(input)?
try it and see, I don't see why not
Sir, it will be more interesting when the form in filled by individuals
and after they will submit the form we get their record in our database .
CAN WE DO THIS??
Of course. Just keep watching the videos
oid mean object id of ORDB (object oriented data-basees).
i didnt smash the like button because i stuck here for 3 days, but i will continue ;o
me too
me three
?
Would it be possible or beneficial to create a *class record* and make it so the attributes of *record* would be name, city etc.?
Why/why not?
beneficial to what?
How would you delete something tho? Like if it’s already in the Database can you do something like c.delete() ?
I think there are videos on deleting records in this playlist
Thanks for doing these videos! Are you able to help with the following? I double check the code and it matches what you've created. "OperationalError: table addresses has 5 columns but 6 values were supplied" do I need new glasses????
Yup, need new glasses. Missing a comma.
@@versaquest ha! Yeah that's usually the case
how do i get the number of rows in a table on python?
Hi there am getting an error where it says “ address_e”: address_e.get()
sqlite3. OperationalError: unrecognized token “:” how do I resolve this?
Obrigado.
You're welcome!
hello im from México and my question is, can i connect pl/sql with python?, good video thanks!!
why not?
Yeah by mysql.connector module
what would be the best way to clear all of the information in the query label after you have fetched info from the database? I made a button that would .destroy the label but im having global variable issues and i can't help but think there is a much easier way im not seeing
config your label. whatever.config(text="")
@@Codemycom I knew it! So much easier than deleting the entire thing and then we making it, thank you very much!
@@Corcontv Sure thing :-)
Hi I was just wondering would python be a better programming language to use than a php crud application?
it depends entirely on your objective
I just wanna ask something. Can we store image to sqlite3 with tkinter?
sure, use BLOB data type...but you probably shouldn't. It's not standard practice.
Hi I'm sorry to ask but for some reason I'm getting an error saying unrecognised token : ":". What should I do. Is it because I'm using multiple frame
Can I use Python to connect to an existing MySQL database and extract some data?
I would like to make a GUI in Tkinter to make queries and read data from an existing MySQL database located on another PC.
Generally, not if it's located on another computer. Unless you can connect to that computer some how...
Interesting that you didn't create the textvariables for the entry boxes and you were able to use them with .get() inside the submit button. Mine didn't work unless I created the textvariables for the entry boxes first
Then you're doing something wrong...check your code for typos..
helloo, sorry to bother u, will you please help me, i get the error 'NoneType object has no atribute get' for the first one, is this what you are talking about? how did you fix it?
i am trying to make custom window color. I changed window bg and buttons bg, yet the borderwidth and gap around button remain to have old Windows color, is it possible to overwrite it?
did you download my free tkinter widget book and check their attributes? I have lots of videos on using styles and themes
Hi, thank you very much for your video. I just followed your video to connect to the database ... but you did not continue with MySQL or SQL. This is very unfortunate.
I have entire courses in both MySQL and SQLite3 on my Codemy.com website
Hey John,
While clicking on the submit button I am getting an error message as ' f_name.get().. Nonetype object has non attribute as 'get'
Can you help me with it
Can't help you without seeing your code. But google: "Nonetype object has non attribute as 'get' " (the error you got) and you should see help.
i also got the same error....did you find solution for it
@@abhinavgupta8896 I also got the same error, bro did you find the error?
Is there any ways to overwrite the updated data when we know it's index position
of course, basic database programming allows that
I'm creating a room booking system where teachers log in and can view other bookings made by users and can create their own bookings too.
I'm using Tkinter I'm making it a desktop application, so the users would have to download the code (system) to their laptop before they use it. I was wondering how I can make a centrally managed database (I think that's what it's called) so when the users log in to the system on their laptop and make a booking it is updated on the database so that everyone can see the bookings that all the teachers have made. I don't want each user to have their own database that is local to their machine and will only show their bookings. Does the database need to reside on one laptop so that the users have to connect to and use that database to see and make bookings? Do you have a tutorial on this or know of one? Thanks.
You're correct, the database would be different on each users computer. You'd need to instead link to an online database.
@@Codemycom how would I do that using sqlite? Do you have a video on it or do you recommend any site/tutorial so I can make it. Thanks
@@020cine Sorry, I don't have any videos on that...
@@Codemycom okay thanks. But do you know if I could link to an online database using sqlite? I've been looking online and I've read that I need to use PostgreSQL to link to an online database. But I'd rather use sqlite as it's built into python
@@020cine Depends on the webhost...
At around the 19:20 mark we can see that his entries are printed in the console, but when I got to this step it would only print: [ ]
I've played around with checking variable names and database terms but it looks fine to me, did anyone else get this? If so how did you fix it?
You have an error in your code somewhere
Hey John,
@13:23 my program is giving an error such as:
sqlite3.operationalError: no such table: addresses
have searched online what it can be, nothing worked.
any suggestion of what can it be?
it's saying your table isn't there. Did you create it with one name and try to access it with another name?
@@Codemycom all sorted john, thank you!
@@douglasmonteiro3085 great!
How do you make an input box where you can search the database with a name and get the information of that person?
You ever know, I've seen pycharm do some weird things...
Hello, when i execute the def submit():
the error is showing
'sqlite3.ProgrammingError: You did not supply a value for binding 1.'
What did you do differently from the video?
the following error occurs in the submit function "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ':Username, :passw, :addrss, :DOB, :emil, :ag)' at line 1"
this happens during the run at 12:44(timestamp) (the variable names are different from the video)
how do i solve it...thanks
try using variable names that aren't different from the video
How to convert to exe file along with SQL to Clint mechine?
hello , I wrote the same script but I received this message:
tkinter.tclerror cannot use geometry manager pack inside . which already has slaves managed by grid
how to fix it?
Thank u
you didn't write the same script. You can't pack and grid in the same parent widget
hi john, first of all thanks for the video while inserting the record I am facing this error ''TypeError: function takes at most 4 arguments (23 given) ''
What did you do differently from the video?
How to put all the above insert ,delete operation in new window after clicking on a single button
and after clicking that single button it should open up the above window
Keep watching the playlist, I discuss all of that.
Hello Sir I am Dheeraj from India I follow whatever you said in this video and write exactly same code but I am getting 1 error which I don't understand how to solve I am new in this so can you please help me to resolve this problem.
File "d:\pyn\TinkierGUI\T.24.py", line 27, in SUBMIT
c.execute('''INSERT INTO addresses VALUES(f_name, l_name, address, city, state, Zipcode)''' ,
sqlite3.OperationalError: no such table: addresses
can you please help ....
❤❤❤❤❤
🙂