Comments (9)
And Jason...
IT WORKS !!!
WOW
Super impressed...
from pysimplegui.
Just quickly.
Problem solved for my app.
Guess, seen the code is so simple, it would be good/nice to implement it as an attribute for the column-Widget anyway...
Also, but not important...
def set_hscroll_position(self, percent_from_top):
...that should be "percent_from_left"...
Cheers!
from pysimplegui.
from pysimplegui.
from pysimplegui.
Simple demo code for horizontal-position scroll.
import PySimpleGUI as sg
def set_hscroll_position(self, percent_from_left):
"""
Attempts to set the horizontal scroll postition for an element's Widget
:param percent_from_left: From 0 to 1.0, the percentage from the left to move scrollbar to
:type percent_from_left: (float)
"""
if self.Type == sg.ELEM_TYPE_COLUMN and self.Scrollable:
widget = self.widget.canvas # scrollable column is a special case
else:
widget = self.widget
try:
widget.xview_moveto(percent_from_left)
except Exception as e:
print('Warning setting the horizontal scroll (xview_moveto failed)')
print(e)
sg.Element.set_hscroll_position = set_hscroll_position
sg.theme("DarkBlue")
sg.set_options(font=("Courier New", 20))
column_layout = [[sg.Input(f"({row}, {col})", size=6, pad=(0, 0), key=("-IN-", row, col)) for col in range(10)] for row in range(10)]
layout = [
[sg.Button("<"),
sg.Column(column_layout, pad=(0, 0), scrollable=True, size_subsample_width=2, size_subsample_height=2, key="-COLUMN-"),
sg.Button(">")],
]
window = sg.Window("Title", layout, finalize=True)
percent = 0
while True:
event, values = window.read()
if event == sg.WIN_CLOSED:
break
elif event == "<" and percent > 0:
percent -= 0.1
window["-COLUMN-"].set_hscroll_position(percent)
elif event == ">" and percent < 1.0:
percent += 0.1
window["-COLUMN-"].set_hscroll_position(percent)
window.close()
from pysimplegui.
WOW
Such a swift reply!
You are a champ, Jason!
Will try this immediately!!!
Thanks...
And quick question...
I registered as a private user... But my application gets traction, and on top of that, I want to support you guys!!!
HOW DO I CONVERT TO A COMMERCIAL LICENSE?
from pysimplegui.
Regarding converting the license to COMMERCIAL, maybe just put a button "UPGRADE" on the License Page.
Simple!
Feel free to close this thread.
ISSUE RESOLVED!
Thanks again.
from pysimplegui.
Yesterday I added this feature to 5.0.4.3. Jason and I used the same name set_hscroll_position
, except that I used parameter named percent_from_left
.
This is the docstring you'll find in the code I checked in.
def set_hscroll_position(self, percent_from_left):
"""
Attempts to set the horizontal scroll postition for an element's Widget
:param percent_from_left: From 0 to 1.0, the percentage from the left to move scrollbar to
:type percent_from_left: (float)
"""
This is the test harness I was using to test it:
import PySimpleGUI as sg
col_layout = [[sg.Text('Column')],
[sg.Multiline(size=(150,40))],
[sg.Input(key='-IN-')],
[sg.Text('Text at the bottom')],
]
layout = [[sg.Column(col_layout, k='-COL-', scrollable=True, size=(400,400))],
[sg.VPush()],
[sg.Text('% to set scroll from left'), sg.In(k='-RIGHT-', s=4), sg.B('Scroll'), sg.Button('Exit'), sg.Sizegrip()]
]
window = sg.Window('Scroll Test', layout, resizable=True)
while True:
event, values = window.read()
print(event, values)
if event == sg.WIN_CLOSED or event == 'Exit':
break
if event == 'Scroll':
window['-COL-'].set_hscroll_position(float(values['-RIGHT-'])/100)
window.close()
I forgot to come back to this issue and post that I made the change. I'm sorry about that! I got really busy.
from pysimplegui.
Regarding converting the license to COMMERCIAL, maybe just put a button "UPGRADE" on the License Page.
We are working on this. In the meantime we're writing a FAQ entry on how to go about changing the license.
Thank you for the support!
from pysimplegui.
Related Issues (20)
- [Question] How to trap an event HOT 2
- [Enhancement] CI friendly handling for the first time installation dialog HOT 3
- [Question] How to update class parameter within inherited class HOT 4
- [Question] How To Re-Enter Data For A Specific Field - AND 'CR to act like TAB HOT 1
- [ Bug] sg.ColorChooserButton Unless Additional Tkinter Import HOT 2
- [Bug] Hitting the image-count limit [Fail to create pixmap with Tk_GetPixmap in TkImgPhotoInstanceSetSize] HOT 6
- [Question] Import error HOT 3
- [Question] Change focus highlight when tabbing to button HOT 8
- [ Enhancement/Bug/Question] NOTE - you can also call sg.main() or sg.main_open_github_issue() to post an issue HOT 1
- [ Question] Compiling Errors since License validation HOT 2
- [ Bug] Broken Doc Link HOT 2
- [Question] NOTE - Table get doesn't work HOT 6
- [ Enhancement] allow arrowheads for lines in tkinter graphs HOT 8
- [Question] Question of shortcut HOT 17
- [Question] How to Use PySimpleGui Programs on Other PCs HOT 1
- [ Question] How to detect when we manually enter a value in combo box in Pysimple GUI HOT 1
- [Bug] Table colored rows flashes when updating in 5.0, while they didn't in 4.x HOT 10
- [Question] No right_click_menu in Combo HOT 3
- [Enhancement] Reusing Context Menu HOT 7
- [ Bug] Garbled output on WSL HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pysimplegui.