1

i'm currently make a python app with GUI with tkinter for data manipulation in pandas. i want to show all data (column and row) and give the scrollbar in vertical and horizontal.

for display all column and row, i've try with :

pd.set_option("display.max_rows", None, "display.max_columns", None)

and it's work. and for scrollbar also succedd show in the app (i'm using tkinter and grid for placing component). But if the column higher than text widget width, pandas will show the symbol backslash and the column who not fit in the widget width will show in the lower data like this.

how to make my pandas data can be linked in horizontal scrollbar? here my piece of code about scrollbar widget

fr_isi_file = tk.Frame(fr_list_judul_isi_file, border=2, relief=tk.GROOVE) lbl_title_isi_file = tk.Label(fr_isi_file, text="Isi File", width=75) fr_isi_file.grid(row=0, column=1, sticky=upper_center) lbl_title_isi_file.grid(row=0, column=0, padx=1, pady=1)

lbl_isi_file = tk.Text(fr_isi_file, width = 100, height = 10, wrap=None) lbl_isi_file_sb_v = Scrollbar(fr_isi_file,orient=VERTICAL) lbl_isi_file_sb_h = Scrollbar(fr_isi_file,orient=HORIZONTAL) lbl_isi_file.grid(row = 1, column = 0, pady = 10, padx = 10) lbl_isi_file_sb_v.grid(row=1, column=1, sticky=NS) lbl_isi_file_sb_h.grid(row=2, column=0, sticky=EW) lbl_isi_file.config(yscrollcommand=lbl_isi_file_sb_v.set) lbl_isi_file.config(xscrollcommand=lbl_isi_file_sb_h.set) lbl_isi_file_sb_v.config(command=lbl_isi_file.yview) lbl_isi_file_sb_h.config(command=lbl_isi_file.xview)

sorry for my bad english and my writing in this post.

*Note, i've been searching 2 day but not get the solution

*update, i've try with

'expand_frame_repr', False

thats make all column show, but the column who not fit in the widget, show in the 2nd line, like this

thank you :)

0

1 Answer 1

0

You need to set expand_frame_repr to False:

pd.set_option('max_rows', None, 'max_columns', None, 'expand_frame_repr', False)
Sign up to request clarification or add additional context in comments.

3 Comments

thankyou for advice, i've try it before and make all column show, but the column who not fit in the widget, show in the 2nd line.
@DiazAdi You need to set wrap='none' when creating the Text widget, i.e. lbl_isi_file = tk.Text(..., wrap='none').
GREAT!!! it's work!! my code have that script who i've found, but in the other tutorial it's wrap=None and nothing happened. thank you so much :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.