Comments (8)
Yes, that's exactly it! and select_clear does indeed do the job. Thank you so much for continuing to explore the issue & coming up with a solution. After 30+ years of software development using high level database languages I'm now playing with Python/PySimpleGUI in my retirement & seeing what I can/can't do with it.
I'd also like to take the opportunity to thank you for such a wonderful tool; I've toyed with a couple of other Python GUI products but love the logic of yours & the support you provide is brilliant, far more than I expected. Much appreciated. LOVE YOUR WORK!
from pysimplegui.
That's great, thanks
from pysimplegui.
I cannot run your code to see what happened.
For following code, it didn't show any problem described in your question.
import PySimpleGUI as sg
size = 21
sg.set_options(font=("Courier New", 11))
layout = [
[sg.Text("Slideshow Title", size=size),
sg.Input(expand_x=True, key="-TITLE-")],
[sg.Text("Wallpaper Config File", size=size),
sg.Input(expand_x=True, key="-WALLPAPER-")],
[sg.Text()],
[sg.Text("Get photos from", size=size),
sg.Input("/home/dje/Backgrounds", key="-PHOTOS-"),
sg.FolderBrowse(key='-LU_PHOTOS-')],
[sg.Text("Collection Name", size=size),
sg.Input("/home/dje/Pictures/slidershow/albany.xml", key="-COLLECTION-"),
sg.FolderBrowse(key='-LU_COLLECTION-')],
[sg.Text()],
[sg.Text("Display for", size=size),
sg.Spin([10, 20, 30, 40, 50], initial_value=30, size=5, key="-DTIME-")],
[sg.Text("Transition Lasts", size=size),
sg.Spin([(i+1)/10 for i in range(10)], initial_value=0.5, size=5, key="-TTIME-")],
[sg.Push(),
sg.Button("OK"),
sg.Button("Cancel")],
]
window = sg.Window("Gnome Background Slideshow", layout, return_keyboard_events=True, use_default_focus=False, finalize=True)
window['-PHOTOS-'].bind('<FocusOut>', '+EXIT+')
while True:
event, values = window.read()
if event == sg.WIN_CLOSED:
break
if event != sg.TIMEOUT_EVENT:
print(event, values)
"""
if event == '-PHOTOS-+EXIT+':
window['-LU_PHOTOS-'].set_focus(force=True)
"""
window.close()
from pysimplegui.
Hmm, that's interesting. I've copied your code, run it & still have the same issue (I tried to get a screenshot of my result but from it you can't tell that the focus has moved to the button, just that the previous field is still highlighted). Just to confirm, you're tabbing through the fields & getting that result? If so, maybe it's something to do with my OS (Linux Pop!-OS 22.04, Gnome 42.9) & there's nothing I can do about it. I might grab my wife's Windows machine & see what that does.
from pysimplegui.
Focus highlighting is different on Linux than on Windows. There may be a difference as well depending on which desktop manager being used on Linux. It's odd that the previous one remains highlighted.
from pysimplegui.
even though it gets the focus the last input field retains the highlight.
By highlight, do you mean "selected"? That is to say, the text is inverse. Like this:
Here's a Trinket for you to try.
https://trinket.io/pygame/94e9026195
Please let me know if it has the behavior you are describing. I do see a difference between Linux and Windows. Trinket is Linux based.
You can clear the selection on an input element by using this kind of call:
window['-PHOTOS-'].widget.select_clear()
This may be a way to get what you're after.
from pysimplegui.
Thrilled to hear on all fronts. Thank you so very much for the complements and incredible display of gratitude. Your message shows extremely well why I'm excited to work every single day. Making a difference in other programmer's lives is so very rewarding. You've made my day, week, and likely month.
I too come from a deep-time era of programming... C and the PC were years away when I worked on my first product. Python was a new discovery for me a few months before beginning writing PySimpleGUI. It quickly felt like "home" to me... that I had found the language I had dreamed of in so many ways.
PySimpleGUI's logic, design, documentation were from living in that era. PySimpleGUI was never meant to be a "thing". It was a throw-away piece of code meant for my own consumption as a way to write another program. I had fun using it and realized that maybe others would have fun with it too.
Thank you again, you truly made quite an impact.
from pysimplegui.
I added and checked in a change in version 5.0.4.8 that enables you to use the Input.update
call to change the selection. Previously, you could only set the value to True
which would select the contents. Now you can also set it to False
which will unselect it.
Here's a test harness:
import PySimpleGUI as sg
layout = [ [sg.Text('Test of Input.update select')],
[sg.Input(12345, key='-IN-', metadata=True)],
[sg.Text('Not Selected', key='-OUT-')],
[sg.Button('Go'), sg.Button('Exit')] ]
window = sg.Window('Window Title', layout)
while True:
event, values = window.read()
if event == sg.WIN_CLOSED or event == 'Exit':
break
if event == 'Go':
if window['-IN-'].metadata:
window['-IN-'].update(select=True)
window['-OUT-'].update('Selected')
else:
window['-IN-'].update(select=False)
window['-OUT-'].update('Not Selected')
window['-IN-'].metadata = not window['-IN-'].metadata
window.close()
from pysimplegui.
Related Issues (20)
- Flask click SystemError when used with pySimpleGUI output redirect HOT 1
- [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 1
- [Bug] Hitting the image-count limit [Fail to create pixmap with Tk_GetPixmap in TkImgPhotoInstanceSetSize] HOT 6
- [Question] Import error HOT 3
- [ 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 6
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.