'How to locate print output? or convert it into jpeg?
I'm trying to show more than one dataframe with using tkinter. There are 2 options for me, showing dataframe directly by using print() and saving dataframe as jpeg and then showing.
I can show my dataframe just by using print() like below:
def printSomething():
button.destroy()
label = Label(root, text= last_row)
label.pack()
label.place(x=3,y=3)
button = Button(root, text="Son Analiz Sonucu", command=printSomething)
button.pack()
But the problem is that I cannot locate the output spesifically, I moved the jpeg by using l.place(x=200,y=1) as you can see below.So, it would be very hard when I want to show more dataframes.
output:
Because of these problems, I decided to convert dataframes into .jpeg or .png files. In order to do that, I used these lines:
from bokeh.io import export_png, export_svgs
from bokeh.models import ColumnDataSource, DataTable, TableColumn
def save_df_as_image(last_row, muck):
source = ColumnDataSource(last_row)
df_columns = [last_row.index.name]
df_columns.extend(last_row.columns.values)
columns_for_table=[]
for column in df_columns:
columns_for_table.append(TableColumn(field=column, title=column))
data_table = DataTable(source=source, columns=columns_for_table,height_policy="auto",width_policy="auto",index_position=None)
export_png(data_table, filename = muck)
But nothing happens when I run it. How can I solve my problem? Thanks
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

