Open Ender-always-wins opened 1 year ago
Can you please provide more context for this issue, as asked in issue template, including code to reproduce? Thanks.
What OS/version is that? What Flet version is that?
Windows 10 and flet 0.8.0 My apologies for adding and deleting comments so i often i couldnt figure out how to enter code in here without ruining indentation
insert the code between ticks:
your code here
def render_shop(page):
shop = flet.GridView(runs_count=4, expand=True)
products = requests.get(url + "/get-names").json() # returns a 20 element long list of strings
for name in products:
PopulateShopGrid(shop, name)
page.add(shop)
class PopulateShopGrid:
def __init__(self, grid, name):
self.name = name
img_link = (requests.get(url + f"\get-url?query={self.name}").json().values())[0]
price = (requests.get(url + f"\get-price?query={self.name}").json().values())[0]
item = flet.Column(
[
flet.Image(
src=img_link,
width=200,
height=200,
),
flet.Row(
[
flet.Text(name.capitalize(), size=20),
flet.Column(
[
flet.Text("price"),
flet.Text(str(price)),
]
),
],
alignment="CENTER",
),
flet.TextButton("View", on_click=lambda e: self.scrape()),
],
horizontal_alignment="CENTER",
)
grid.controls.append(flet.Card(content= item))
flet.app(render_shop)
This gets pretty close to that, i tried using a single link instead of having a changed one each time but the result wasnt same
Could you paste a runnable code please? It's part of a program only.
i tried to create another code snippet which was independent of everything else, but it wasnt getting above 300-400 mb, which would be reasonable if i am loading 20 images.
I have this really basic flet app with a simple UI There are 20 of these cards in the program, and two textbuttons below these, I am using GridView. However whenever i run the app and then check the task manager, there is a new program running called "flet description" which takes about 30 mb memory in the start but then slowly creeps up to 2 gb, I tried using memory profilers, but i couldnt find anything significant. This unexplained high ram usage is significantly slowing my laptop down, please take a look at the issue.