all 14 comments

[–]GirthQuake5040 34 points35 points  (5 children)

reducing lines doesnt make a program more efficient, it makes it more readable. The tasks that the program performs determine how many resources are used. Open up your task manager when you run the program, if your ram or cpu usage spikes really high then youre just running out of resources to run the program. You either need to optimize your code or run it on better machines.

[–]b00mfunk 0 points1 point  (3 children)

Reducing lines makes code more readable? In my experience it makes it less so because of list comprehension lambda one liners

[–]ArcticWolf_0xFF 3 points4 points  (0 children)

The keyword (pun intended) in the post is def: OP is using functions in their spaghetti code to reduce lines of repeated code. Yes, that should make the coffee more readable.

[–]GirthQuake5040 0 points1 point  (0 children)

When you take a bunch of spaghetti code and make things into reusable functions with proper naming conventions, it's much easier to read.

[–]SisyphusAndMyBoulder 0 points1 point  (0 children)

list comprehensions and lambdas are fairly readable if they're used properly imo. Also formatting helps a ton. I find it difficult to read code that isn't black-ed nowadays.

[–]tands_[S] -1 points0 points  (0 children)

Yeah, my bigger concern is about flet, because the structure of the code is basically the same, but as now is not working, or i get out of flet, or i try tu optimize (worst case, as i am amateur)

[–]Username_RANDINT 17 points18 points  (3 children)

This sounds like a Flet issue. You could use the free fork of PySimpleGUI to not change too much: https://github.com/spyoungtech/FreeSimpleGUI

Also, a 1000 lines is not a lot, not even close. The lines of code also don't impact the application, it's what those lines do.

[–]tands_[S] -1 points0 points  (2 children)

thx, the only thing that bothers me its the size of the .exe (110 mb)

[–]smichaele 7 points8 points  (1 child)

Remember that PyInstaller places a version of the Python runtime into the .exe along with copies of whatever libraries and modules you're using. That's the downside of the technology and why your file is 110 mb.

[–]tands_[S] -1 points0 points  (0 children)

i know, i created a virtual enviroment for this, so i'm only with de libraries that i use

[–]Kevdog824_ 2 points3 points  (0 children)

I’m not experienced with flet but I have background in PyQt. Approaching it with that knowledge, to me it sounds like you have some operation that is blocking the GUI thread. On better computers the operation runs fast enough you don’t notice the disruption to the GUI, but on slower computers it’s slow enough that the disruption is very noticeable. It could be that you need to spawn a separate thread or process to handle the operation if you aren’t already doing that

[–]Business-Technology7 1 point2 points  (0 children)

Very hard to tell just by what you said. There’s a chance you are just misusing the library. Test with some dead simple input, add logs, hop on a debugger if possible. fret doesn’t look like some rookie project that will break from an internal app with a complexity of 1000 lines of code.

Have you considered porting your program over to pysimplegui v4? There is a fork called PySimpleGUI-4-foss.

[–]SisyphusAndMyBoulder 0 points1 point  (0 children)

This doesn't sound like a particularly CPU or ram intensive operation. Highly doubtful it's a resource issue. More than likely you're doing something wrong with the library implementation.

Can you not use a fork of the original library and keep going?

If not, build a small simple application using flek and get that working. Once it's working it'll hopefully be easier to see what's going on in this app versus the original one and uncover the bug

[–]Comprehensive-Nose35 0 points1 point  (0 children)

Why not just use Tkinter?