PySimpleGUI / PySimpleGUI/PySimpleGUI

Bug , radius of circle

未关闭
#2,388 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

duplicate
主要语言
Python
星标
13.8k
派生
1.8k
PR 合并指标
30 天内没有已合并 PR

描述

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

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 PySimpleGUI.py 中的 Graph.DrawCircle 开始,重点查看 radius_converted 的计算以及第 3116 行附近的 create_oval 调用。在 TkInter 端口上使用一个小型 Graph 示例重现该问题,并验证圆形的边界始终使用用户的坐标系。

由索引模型根据 Issue 内容生成。

评估

技术栈
python
领域
computer-graphics, desktop
Issue 类型
缺陷
难度
2/5
预计耗时
1-3 小时
活跃度
停滞
描述清晰度
描述清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。