Open Attocia opened 4 years ago
I recall having some problems with the edges back when I made the Crossword Puzzle demo program. The workaround I used then was to add an "edge offset". It's not ideal, but will get you up and running while the root cause it being determined.
Thank you for a working bit of code. It's extremely helpful to have these.
Yes, If I shift all figures right and down one point, it will be fine. Just not sure if there's a bug in Graph methods. Here's the code show the problem. There are two invisible lines of rectangle, top one and left one, but right one and bottom one are OK. Checked by zoom software, it did miss all the points for x=0, and all the point for y=max.
The other problem If DrawRectangle with two points which has same x or same y, the line width will be 2, not 1. Also checked by zoom software.
import PySimpleGUI as sg
layout = [[sg.Graph(canvas_size=(100, 100),
graph_bottom_left=(0,0),
graph_top_right=(99, 99),
key='Graph')]]
window = sg.Window('Graph Test', layout=layout, finalize=True)
draw = window.find_element('Graph')
draw.DrawRectangle((0, 99), (99, 0))
while True:
event, values = window.read()
if event == None:
break
window.close()
Type of Issues (Bug)
Operating System
Windows 7
Python version
3.7.2
PySimpleGUI Port and Version
Version 4.17.0, port PySimpleGUI
Your Experience Levels In Months or Years
Approx. 1 year Python programming experience Approx. 2 years programming experience overall Have previously used another Python GUI Framework
You have completed these steps:
Description of Problem / Question / Details
When attempting to place an image on the edge or in the corner of a graph element, it seems there is a 1px inner border of the background colour which prevents the image from fully rendering.
Attached is the image used for the code provided and another one demonstrating the issue.
Expected result: The 20x20 image renders in the top left, with 1px of green on the edges. Actual result: The 20x20 image renders in the top left, however the 1px of green in contact with the edge of the graph is displayed as the blue background colour.
Code To Duplicate