My TKinter textbox formats weirdly and does not look like the command text. I have a pandas db and it inserts it weirdly. Any ideas what I'm doing wrong?
table = PrettyTable()
# Set the column names
table.field_names = df.columns.tolist()
for row in df.itertuples(index=False):
table.add_row(row)
textbox_string = str(table)
#df.columns = ['owner ', 'project ', 'branch ', 'updated ', 'insertions ', 'deletions ']
#df.style.set_properties(subset=pd.IndexSlice[:, :], **{'width': '50px'})
#textbox_string = df.to_string(index=True, justify='center')
print(textbox_string)
root.textbox.configure(font=("Roboto", 14))
root.textbox.insert("0.0",textbox_string)
Console text the console text Here's how the GUI shows it TKinter textbox text
I'm a bit new on this. Does anyone have any idea?
I've tried multiple things, but none have worked
CodePudding user response:
Replace this line
root.textbox.configure(font=("Roboto", 14))
with this
root.textbox.configure(font='TkFixedFont')
This will use the system monospace font. If you prefer to explicitly set it to Roboto, use Roboto Mono instead, like this:
root.textbox.configure(font=("Roboto Mono", 14))