Python 数据库结构和更新值以及过渡到 GUI

发布于 2024-11-17 17:43:51 字数 670 浏览 7 评论 0原文

我正在用 python 编写一个程序,该程序需要大约 100 个输入并生成大约 500 个输出。中间需要进行许多计算,并且我在构建该程序时遇到了一些问题。我目前正在设置程序以通过命令行接收输入,但尚未决定如何显示输出。在我开发这个程序的最后,需要实现它以接收 GUI 形式的输入并以 GUI、Excel 工作表甚至 pdf 的形式显示输出。

第一个问题是构建输入,输入当前被收集到属于其他类的类中,这些类属于其他类,依此类推。我当前设置的方式是我的类是其他类的多个实例的集合。顶级类可以有其他每个类的多个实例。 (这就是为什么我很难切换到数据库结构,我也没有太多关于数据库的知识并且从未使用过它们)

第二个问题是编辑输入以查看新输出。如果用户更改了层次结构中非常深的一个输入,我必须调用顶级类进入内部的一个,然后再调用该内部的一个,等等,这对于每个变量进行编程变得非常麻烦。因此,我需要找到一种方法来轻松访问所有属性,并能够自动更新所有其他存储的因变量,这些变量会导致输出也应该更新。

第三个问题实际上是在计算上。我的一些计算需要迭代方程,例如 a = 2b b= 3c c = 2a ,需要找到 ab 和 c。我不明白如何在 python 中解决这个问题。我是否必须找出微分方程,或者我可以像我目前在 Excel 中那样做吗?

第四个问题是如何将其转换为 GUI 和 Excel 输出。

希望这能很好地解释问题,感谢您花时间阅读本文。 请指教。

Im working on a program in python that takes approximately 100 inputs and generates around 500 outputs.There are many calculations that have to be done in the middle and I am having several problems with structuring this program. I am currently setting up the program to receive inputs through command line and haven't decided how to display the outputs yet. At the end of my development of this program it needs to be implemented to receive inputs in the form of a GUI and display outputs in the form of the gui, an excel sheet and maybe a pdf.

First problem is structuring the inputs, inputs are currently collected into classes that belong in other classes that belong in other classes and so on. The way I have it currently set up is that I have classes that are a collection of several instances of other classes. The top class can have several instances of each of the other classes. (This is why im having a hard time switching to a database structure, i also don't have that much knowledge about databases and have never worked with them)

Second problem is editing inputs to see the new outputs. If the user changes one input that is very deep in the hierarchy i have to call the top class go into the one inside then the one inside that etc and that has become such a hassle to program for each variable. So I need to figure out a way to easily access all the attributes and be able to automatically update all the other stored dependent variables that lead to the outputs which should also then update.

Third problem is actually in the calculations. Some of my calculations require iterations of the equation so for example a = 2b b= 3c c = 2a , need to find a b and c. I don't understand how to figure that out in python. Would i have to figure out the differential equation or can I just do this like i currently have it in excel?

Fourth problem is how to transition this to a gui and excel output.

Hope this explains the problems well enough, thanks for taking the time to read this.
Please Advise.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

青衫负雪 2024-11-24 17:43:51

您所描述的包含具有不同类型数据的其他类实例的类实例非常适合 sqlalchemy 。这为您提供了一种将类直接绑定到基础数据库表的方法。

如果您定义一个类,通过数据库表来描述输出以及与输入的关系,那么只需从数据库重新加载输入即可更新输出。

使用本地 sqlite 数据库存储数据也非常适合在 GUI 中显示并导出到 Excel。

What you describe in terms of having class instances containing other class instances with different types of data fits in really well with sqlalchemy. This provides you with a way to tie classes directly to underlying database tables.

If you define a class describing your output with relationships to your input through database tables, then all it takes is reloading your input from the db to update your output.

Using a local sqlite db to store data also lends well to displaying in a gui and exporting to excel.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文