PySimpleGUI / PySimpleGUI/PySimpleGUI

Bug , radius of circle

Open
#2,388 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

duplicate
Dominant language
Python
Stars
13.8k
Forks
1.8k
PR merge metrics
No merged PRs in 30d

Description

Type of Issues (Enhancement, Error, Bug, Question)

bug

Operating System

windows

Python version

3.6

PySimpleGUI Port and Version

TkInter

Your Experience Levels In Months or Years

_________ Python programming experience
2 years
_________ Programming experience overall
10 years
_________ Have used another Python GUI Framework (tkiner, Qt, etc) previously (yes/no is fine)?
yes

You have completed these steps:
  • Read instructions on how to file an Issue
  • Searched through main docs http://www.PySimpleGUI.org for your problem
  • Searched through the readme for your specific port if not PySimpleGUI (Qt, WX, Remi)
  • Looked for Demo Programs that are similar to your goal http://www.PySimpleGUI.com
  • Note that there are also Demo Programs under each port on GitHub
  • Run your program outside of your debugger (from a command line)
  • Searched through Issues (open and closed) to see if already reported

your method for Drawing a circle don't use the user's coordinate system
the radius _converted is calculated but not used at line 3116
From PySimpleGUI.py

Code or partial code causing the problem
    def DrawCircle(self, center_location, radius, fill_color=None, line_color='black'):
        """
        Draws a circle, cenetered at the location provided.  Can set the fill and outline colors
        :param center_location: Union [Tuple[int, int], Tuple[float, float]] Center location using USER'S coordinate system
        :param radius: Union[int, float] Radius in user's coordinate values.
        :param fill_color: (str) color of the point to draw
        :param line_color:  (str) color of the outer line that goes around the circle (sorry, can't set thickness)
        :return: Union[int, None] id returned from tkinter that you'll need if you want to manipulate the circle
        """
        if center_location == (None, None):
            return
        converted_point = self._convert_xy_to_canvas_xy(center_location[0], center_location[1])
        radius_converted = self._convert_xy_to_canvas_xy(0, radius)

        if self._TKCanvas2 is None:
            print('*** WARNING - The Graph element has not been finalized and cannot be drawn upon ***')
            print('Call Window.Finalize() prior to this operation')
            return None

        try:  # needed in case the window was closed with an X
            id = self._TKCanvas2.create_oval(int(converted_point[0]) - int(radius), int(converted_point[1]) - int(radius),
                                             int(converted_point[0]) + int(radius), int(converted_point[1]) + int(radius), fill=fill_color,
                                             outline=line_color)
        except:
            id = None
        return id

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in PySimpleGUI.py at Graph.DrawCircle, especially the radius_converted calculation and the create_oval call around line 3116. Reproduce the issue with a small Graph example on the TkInter port and verify that circles use the user's coordinate system consistently for their bounds.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
computer-graphics, desktop
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.