Python Forum
PysimpleGUI window update dynamically
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PysimpleGUI window update dynamically
#2
]Can you describe what you mean by this:
Quote:Can someone help me make a class for that as screenshots?
1)More parameter checking only copy a class.
2)when check file without goldensample how to handle this issue.
I might understand what you mean with goldensample. You are wondering what to do if this is an empty dataframe.
 df = pd.read_csv(csv_add, header=2)
    df = df[df["Lot Code"].str.contains("golden")]
I would have the readcsv() function return None if is no golden data in the file.
import pandas as pd


def read_csv():
    df = pd.DataFrame(
        {"Lot Code": ["G", "B", "G"], "Numbers": [5, 6, 7], "Letters": ["A", "B", "C"]}
    )
    df = df[df["Lot Code"].str.contains("G")]
    if len(df) == 0:
        return None
    return df["Numbers"].values, df["Letters"].values


x = read_csv()
if x is None:
    sg.popup("Error", "There's no golden data!")
else:
    numbers, letters = x
    print(numbers, letters)
Reply


Messages In This Thread
PysimpleGUI window update dynamically - by SamLiu - Mar-27-2023, 01:59 PM
RE: PysimpleGUI window update dynamically - by deanhystad - Mar-27-2023, 03:44 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Interaction between Matplotlib window, Python prompt and TKinter window NorbertMoussy 3 736 Mar-17-2024, 09:37 AM
Last Post: deanhystad
Photo PySimpleGUI FilesBrowse enable event to update value in combo SamLiu 2 4,762 Mar-15-2023, 12:49 PM
Last Post: SamLiu
  [Tkinter] Can't update label in new tk window, object has no attribute tompranks 3 3,695 Aug-30-2022, 08:44 AM
Last Post: tompranks
  PySimpleGUI Try Except jamesaarr 1 2,000 Nov-18-2021, 02:02 PM
Last Post: jamesaarr
Question closing a "nested" window with a button in PySimpleGUI and repeating this process Robby_PY 9 13,785 Jan-18-2021, 10:21 PM
Last Post: Serafim
  how to add elements in the other window? (pysimplegui) syafiq14 0 2,366 Jul-20-2020, 10:35 PM
Last Post: syafiq14
  Want to dynamically update numbers using tkinter in pygame script k0gane 0 2,116 Feb-09-2020, 09:01 AM
Last Post: k0gane
  tkinter window and turtle window error 1885 3 6,841 Nov-02-2019, 12:18 PM
Last Post: 1885
  [PyQt] how to dynamically add label to pyqt window Joongi 3 10,789 Sep-10-2019, 01:38 PM
Last Post: Denni
  Need help setting up a PySimpleGUI progress bar that I can maually update in script Soundtechscott 1 10,161 Jun-10-2019, 06:14 AM
Last Post: Soundtechscott

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020