4.28.0 Released 3-Aug-2020
____2y_____ Python programming experience
____5y_____ Programming experience overall
____no_____ Have used another Python GUI Framework (tkinter, Qt, etc) previously (yes/no is fine)?
Warning setting the vertical scroll (yview_moveto failed)
'TkScrollableFrame' object has no attribute 'yview_moveto'
This program is creating a window which contains a column that has a pre determined layout containing all the mentioned input boxes and a pre determined sizes.
in addition there are the discussed buttons inside.
form = sg.Window('analysis').Layout([
[sg.Column(layout, size=(width / 3, height / 2), scrollable=True, key = "Column")],
[sg.OK(), sg.Button('Up', key = "up"), sg.Button('Down', key = "down")]
])
while True:
event, values = form.read()
if(event == sg.WIN_CLOSED):
break
elif(event == "down"):
form.Element('Column').set_vscroll_position(1.0)
elif(event == "up"):
form.Element('Column').set_vscroll_position(0.0)
Columns are special and will need some additional code done in order to manipulate their scrollbars. Didn't think to document / handle this element. The code operates on the "Widget" and the Column element on its own isn't a standalone Widget like some of the others with scrollbars.
The set_scroll_position is a really simple function:
self.Widget.yview_moveto(percent_from_top)
The vertical scrollbar is a member variable:
Widget.vscrollbar
I think you should be able to manipulate this scrollbar directly as a workaround. I haven't tried it yet but wanted to get you the info so you can see if you're able to make something work.
Thank you very much for the quick response, but i have some follow up question:
1) by "manipulate this scrollbar directly as a workaround" are you suggesting solutions that are not necessarily related to pysimplegui, such as bots or a connected program?
2) Will it be inserted to the column element later on?
3) What other element is a stand alone widget that I can use instead?
with respect,
roey-coding
It was originally added, not long ago, for the Table element
https://github.com/PySimpleGUI/PySimpleGUI/issues/1878
I will use a table but in the future i would love to get back to column so i'm keeping this issue open until columns will be supported in controlling the scrollbar, for all of the columns users out there.
In the mid time, can you please direct me to the place in your code where the columns? in order to use tkinter calls I need to know exactly what is a column and how does it look in code.
please update here when the feature is added, for the sake of all the column users out there.
with respect,
roey-coding
I'm sorry I don't have the ability to step you through adding this feature.
Here's the code to show how to control the scrollbar at this moment.
import PySimpleGUI as sg
font = ('Courier New', 16)
text = '\n'.join(chr(i)*50 for i in range(65, 91))
column = [[sg.Text(text, font=font)]]
layout = [
[sg.Column(column, size=(800, 300), scrollable=True, key = "Column")],
[sg.OK(), sg.Button('Up', key = "up"), sg.Button('Down', key = "down")],
]
window = sg.Window('Demo', layout, finalize=True)
while True:
event, values = window.read()
if event == sg.WIN_CLOSED:
break
elif event == "down":
window['Column'].Widget.canvas.yview_moveto(1.0)
elif event == "up":
window['Column'].Widget.canvas.yview_moveto(0.0)
window.close()
Thank you very much jason990420 and PySimpleGUI for you helpful responses, hopefully it will be added in the future, keeping it open until the far future update that will make an official method but for know that will definitely do.
with respect,
revolution
Most helpful comment
Here's the code to show how to control the scrollbar at this moment.