Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I am new to Python and to train myself, I would like to use Python build a database that would store information about wine - bottle, date, rating etc. The idea is that:
I could use to database to add a new wine entries
I could use the database to browse wines I have previously entered
I could run some small analyses
The design of my Python I am thinking of is:
Design database with Python package sqlite3
Make a GUI built on top of the database with the package Tkinter, so that I can both enter new data and query the database if I want.
My question is: would your recommend this design and these packages? Is it possible to build a GUI on top of a database? I know StackOverflow is more for specific questions rather than "project design" questions so I would appreciate if anyone could point me to forums that discuss project design ideas.
Thanks.
For a beginner, these packages are well suited.
tkinter and sqlite3 are both builtin in the standard library, so you don't have to install complicated MySQL or GUI libraries. There are many tutorials outside for both libraries.
I think you can even search for something like tkinter with sqlite3 and you will find some examples.
Combining tkinter and sqlit3 is no problem. I did't read the full answer but I think this could be a useful resource: Python TKinter data entry window GUI for SQLITE3 table
If you have specific questions about how to achieve certain things you are welcome to ask them in the comments of this answer.
If it's just for you, sure there is no problem with that stack.
If I were doing it, I would skip Tkinter, and build something using Flask (or Django.) Doing a web page as a GUI yields faster results, is less fiddly, and more applicable to the job market.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 months ago.
Improve this question
I am relatively new to coding and I'm currently doing my a level computer science coursework. I'm doing a text based RPG game in python 3. The problem I've ran into is I've coded the entire game with the outputs into the console of VS code, but I need to create a gui for the game. Just a simple window with one textbox that outputs everything the console outputs currently and a textbox that allows for any user input via typing. And maybe a backdrop for the gui. I've scoured the internet for solutions but I cannot find one. The gui don't need to be very fancy. Does anyone have the knowledge of any modules of ways I can easily slap a gui ontop of my code? Thank you in advanced.
For a basic GUI you can use TKinter: Documentation
It's very easy to use and there are a lot example on the web that you can reference
I believe you can use the tkinter (“Tk interface”) package for this. It's a simple and straightforward standard interface in Python to the Tcl/Tk GUI toolkit, and the only GUI framework that comes built into Python itself. Considering your mentioned requirements for the project, you should easily be able to create what you want — an entry widget, for instance (example).
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this question
I really am lost.
I've written a python script which takes two files, converts one to the same format as the second and outputs the differences.
I now need to create some kind of GUI?
I'm thinking a relatively simple HTML page which allows users to click on two separate boxes to upload each of the files and then submit them - resulting in the output being offered as file which the user can download to the PC.
Any help of direction would be really appreciated. It's only really a guess that HTML will be my best/simplest choice. Working from the command line isn't really an option I can go with. The PC that this will sit on will not have internet access. I intend to have this installed on the PC as an application.
I accept I'll need to make some changes to my Python code. Posted this here as I'm not sure Python questions would have been the best place but I'll move it if suggested.
Please, any help at all will be useful. First timer
This is not a kind of answer that normally gets a reply on StackOverflow because it is much too broad / subjective.
Given the fact that you are quite new I would like to provide a solution anyway that will allow you to build a GUI quite easily like EasyGUI.
A very easy example:
import easygui
easygui.msgbox('This is a basic message box.', 'Title Goes Here')
Other possibilities (less customizable but arguably easier) are Wooey (automatic web interface generation for your script) and Gooey (automatic GUI generation for your script.
Please, for next time, remember to always provide a Minimal Reproducible Example and read https://stackoverflow.com/help/how-to-ask
I don't suggest you use the Django Framework for such a small application.
You should definitely use Flask for this. Flask is more lightweight
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
So I have made a project website with a couple html files, css and some javascript. I was thinking that I would add a login functionality and some other things like that. So I set off to find out what would be good for it. Now its is hard for me because I can't decide which one to use. I saw Django on python but I had to make a whole new project for it and I have to start from scratch. I was just thinking I would add a database to this site using something. I am just doing some lightweight things. What should I use? Thank you.
Well if you are not going to use python for this with Django, you could use PHP and MySQL. I do it all the time for small sites. Basically just go to your hosting panel and create a new DB and then use php to create a connection script and then go from there as far as adding and using the database. All web hosts support this feature that I know of. If you go with Django though, you can simply add the sqllite3 DB or use something like MongoDB or any other DB out there really. Please look up the exact documentation for whichever route you choose.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
Basically I want to create a sexy GUI using HTML5 then call code that I wrote in python. I have just discovered some tutorials about web2py, however I am getting the videos now from youtube so I can only watch when I get home. (Life of a student with no internet at home).
So basically I have written a python script, now I want to use a webpage to interact with that script instead of terminal as I have been doing. So I have a webpage provide me the GUI to my python app.
Hope this makes more sense.
Any help and direction will be greatly appreciated.
Thanks in advance
You need to flip that around, you want to run server-side python code that renders your sexy HTML5 GUI. There are many Python frameworks that are suitable to this, including web2py, django, and my personal favorite flask.
Any of these frameworks will let your python code run, then render the HTML with python variables/functions available by using a templating engine (for example Flask uses Jinja template). Tutorials are readily available for all of these python libraries, but if you want to take a look at Flask, I can recommend Miguel Grinberg's excellent tutorial series.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I tend to start projects that are far beyond what I am capable of doing, bad habit or a good way to force myself to learn, I don't know. Anyway, this project uses a postgresql database, python and sqlalchemy. I am slowly learning everything from sql to sqlalchemy and python. I have started to figure out models and the declarative approach, but I am wondering: what is the easiest way to populate the database with data that needs to be there from the beginning, such as an admin user for my project? How is this usually done?
Edit:
Perhaps this question was worder in a bad way. What I wanted to know was the possible ways to insert initial data in my database, I tried using sqlalchemy and checking if every item existed or not, if not, insert it. This seemed tedious and can't be the way to go if there is a lot of initial data. I am a beginner at this and what better way to learn is there than to ask the people who do this regularly how they do it? Perhaps not a good fit for a question on stackoverflow, sorry.
You could use a schema change management tool like liquibase. Normally this is used to keep your database schema in source control, and apply patches to update your schema.
You can also use liquibase to load data from CSV files. So you could add a startup.csv file in liquibase that would be run the first time you run liquibase against your database. You can also have it run any time, and will merge data in the CSV with the database.