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 摘要。