'Displaying statistical result in a GUI

I have a dataset and perform kaplan meier analysis on it using lifelines library, I then perform log rank and cox analysis, but the output i receieve are type 'statistical result' I would live to display this on a GUI but cannot figure it out.



Solution 1:[1]

You can save the data as a csv file.

From this, a (or any) package like tkinter can read the CSV.

Here is a stackoverflow link to such:

How to show csv file in a grid?

And here is an example of the code:

import tkinter
import csv

root = tkinter.Tk()

# open file
with open("test.csv", newline = "") as file:
   reader = csv.reader(file)

   # r and c tell us where to grid the labels
   r = 0
   for col in reader:
      c = 0
      for row in col:
         # i've added some styling
         label = tkinter.Label(root, width = 10, height = 2, \
                               text = row, relief = tkinter.RIDGE)
         label.grid(row = r, column = c)
         c += 1
      r += 1

root.mainloop()

Obviously, you would need to apply your variant to this.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 D.L