[Enhancement ] Keep graph coordinate system constant after graph element changes in size
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 38/100
Direção de pesquisa
Execute a reprodução em Python fornecida e inspecione a propriedade TopRight do elemento Graph juntamente com o tratamento do evento da janela. Confirme como o redimensionamento altera o mapeamento das coordenadas do gráfico e, em seguida, verifique se redefinir TopRight para (200, 200) mantém as coordenadas do cursor nesse intervalo após um redimensionamento horizontal.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Question
Operating System
Windows 11
PySimpleGUI Port (tkinter, Qt, Wx, Web)
tkinter
Versions
Python version (sg.sys.version)
3.10.11
PySimpleGUI Version (sg.__version__)
4.60.4
GUI Version (tkinter (sg.tclversion_detailed), PySide2, WxPython, Remi)
8.6.12
Troubleshooting
These items may solve your problem. Please check those you've done by changing - [ ] to - [X]
- Searched main docs for your problem www.PySimpleGUI.org
- Looked for Demo Programs that are similar to your goal. It is recommend you use the Demo Browser! Demos.PySimpleGUI.org
- None of your GUI code was generated by an AI algorithm like GPT
- If not tkinter - looked for Demo Programs for specific port
- For non tkinter - Looked at readme for your specific port if not PySimpleGUI (Qt, WX, Remi)
- Run your program outside of your debugger (from a command line)
- Searched through Issues (open and closed) to see if already reported Issues.PySimpleGUI.org
- Have upgraded to the latest release of PySimpleGUI on PyPI (lastest official version)
- Tried using the PySimpleGUI.py file on GitHub. Your problem may have already been fixed but not released
Detailed Description
I have a graph element with expand_x=True and expand_y=True and want to keep a constant coordinate system 0 <= x,y <= 200 even after the graph size changes. I set the TopRight attribute to (200, 200) every time the window size changes (configure event). Unfortunately the coordinate system does not respect the new TopRight value and instead scales proportionally with the graph element size.
Steps to reproduce:
- Run code below
- Confirm graph size is 200x200 in console output
- Move mouse cursor to top right corner: Cursor coordinates will say roughly 200x200
- Resize window to twice the width so that the console output says roughly 400x200
- Move mouse cursor to top right corner: Cursor coordinates will say roughly 400x200
Expected results:
After resizing and explicitly setting TopRight = (200, 200) I would expect the top right cursor coordinates to be 200x200. Instead the top right cursor coordinates are 400x200.
Code To Duplicate
import PySimpleGUI as sg
def main():
layout = [
[sg.Graph(canvas_size=(200, 200),
graph_bottom_left=(0, 0),
graph_top_right=(200, 200),
key="-GRAPH-",
motion_events=True,
enable_events=True,
background_color="white",
expand_x=True,
expand_y=True,
drag_submits=True)],
]
window = sg.Window("Window", layout, finalize=True, resizable=True)
window.bind("<Configure>", "-CONFIGURE-")
while True:
event, values = window.read()
if event == sg.WIN_CLOSED:
break
graph = window["-GRAPH-"]
if event == "-CONFIGURE-":
print("New graph size:", graph.get_size())
graph.TopRight = (200, 200)
elif event == "-GRAPH-+MOVE":
print("Mouse position:", values["-GRAPH-"])
window.close()
if __name__ == "__main__":
main()
- Linguagem predominante
- Python
- Estrelas
- 13.8k
- Forks
- 1.8k
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de PySimpleGUI/PySimpleGUI
-
Bug Done - Install Dev Build (see docs for how) Platform Specific Issue - Linux Port - TK
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
PySimpleGUI/PySimpleGUI#6904 · 15 comentários ·
-
Bug Demo Programs Done - Install Dev Build (see docs for how) Interoperability Port - TK workaround available
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
PySimpleGUI/PySimpleGUI#6900 · 1 comentário ·
-
Done - Install Dev Build (see docs for how) enhancement
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 62/100
PySimpleGUI/PySimpleGUI#3251 · 12 comentários ·
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 74/100
PySimpleGUI/PySimpleGUI#6906 · 1 comentário · 1 reação ·
-
Bug Done - Install Dev Build (see docs for how) Port - TK
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 45/100
PySimpleGUI/PySimpleGUI#6902 · 1 comentário ·
Todas as issues de PySimpleGUI/PySimpleGUI
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
anthropics/skills#1811 · 1 comentário ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
speaches-ai/speaches#678 ·
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
datalayer/mcp-compose#42 ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
conda-forge/spacy-feedstock#177 ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
UKGovernmentBEIS/inspect_evals#2523 ·