使用elide隐藏文本时的性能影响

时间:2017-04-14 17:29:09

标签: python python-3.x text tkinter tk

我已经设置了一个带有标签的文本小部件,这些标签会使用elide隐藏信息部分。它可以正常输入,但是如果我用elide隐藏大部分文本,我会看到性能命中。我注意到的文本文件大约是53,000行,对于较小的文件,影响较小。该程序运行良好,我能够在窗口中滚动和移动没有问题,直到我隐藏我的文本部分。

SELECT  SUM(CASE WHEN LineOfCoverage = 'Earthquake' AND BusinessType = 'New Business' AND Description = 'Bound'         THEN [Bound Premium] ELSE 0 END) as EQBoundNB,
        SUM(CASE WHEN LineOfCoverage = 'Earthquake' AND BusinessType = 'New Business' AND Description = 'Lost'          THEN [LostPremium] ELSE 0 END) as EQLostNB,
        SUM(CASE WHEN LineOfCoverage = 'Earthquake' AND BusinessType = 'New Business' AND Description = 'Not Taken Up'  THEN [NotTakenUpPremium] ELSE 0 END) as EQNtUpNB,
        SUM(CASE WHEN LineOfCoverage = 'Earthquake' AND BusinessType = 'New Business' AND Description = 'Quoted'        THEN [QuotedPremium] ELSE 0 END) as EQQuotedNB,
                    /* Earthquake, Renewal, by Description */
        SUM(CASE WHEN LineOfCoverage = 'Earthquake' AND BusinessType = 'Renewal' AND Description = 'Bound'          THEN [Bound Premium] ELSE 0 END) as EQBoundRN,
        SUM(CASE WHEN LineOfCoverage = 'Earthquake' AND BusinessType = 'Renewal' AND Description = 'Lost'           THEN [LostPremium] ELSE 0 END) as EQLostRN,
        SUM(CASE WHEN LineOfCoverage = 'Earthquake' AND BusinessType = 'Renewal' AND Description = 'Not Taken Up'   THEN [NotTakenUpPremium] ELSE 0 END) as EQNtUpRN,
        SUM(CASE WHEN LineOfCoverage = 'Earthquake' AND BusinessType = 'Renewal' AND Description = 'Quoted'         THEN [QuotedPremium] ELSE 0 END) as EQQuotedRN,

                /* Wind, New Business, by Description */
        SUM(CASE WHEN LineOfCoverage = 'Wind' AND BusinessType = 'New Business' AND Description = 'Bound'           THEN [Bound Premium] ELSE 0 END) as WindBoundNB,
        SUM(CASE WHEN LineOfCoverage = 'Wind' AND BusinessType = 'New Business' AND Description = 'Lost'            THEN [LostPremium] ELSE 0 END) as WindLostNB,
        SUM(CASE WHEN LineOfCoverage = 'Wind' AND BusinessType = 'New Business' AND Description = 'Not Taken Up'    THEN [NotTakenUpPremium] ELSE 0 END) as WindNtUpNB,
        SUM(CASE WHEN LineOfCoverage = 'Wind' AND BusinessType = 'New Business' AND Description = 'Quoted'          THEN [QuotedPremium] ELSE 0 END) as WindQuotedNB,
                /* Wind, Renewal, by Description */
        SUM(CASE WHEN LineOfCoverage = 'Wind' AND BusinessType = 'Renewal' AND Description = 'Bound'        THEN [Bound Premium] ELSE 0 END) as WindBoundRN,
        SUM(CASE WHEN LineOfCoverage = 'Wind' AND BusinessType = 'Renewal' AND Description = 'Lost'         THEN [LostPremium] ELSE 0 END) as WindLostRN,
        SUM(CASE WHEN LineOfCoverage = 'Wind' AND BusinessType = 'Renewal' AND Description = 'Not Taken Up' THEN [NotTakenUpPremium] ELSE 0 END) as WindNtUpRN,
        SUM(CASE WHEN LineOfCoverage = 'Wind' AND BusinessType = 'Renewal' AND Description = 'Quoted'       THEN [QuotedPremium] ELSE 0 END) as WindQuotedRN,
        CASE WHEN LineOfCoverage = 'Earthquake' THEN  'Earthquake' ELSE 'Wind' END as LineOfCoverage,
        'Earthquake' as Earthquake,
        'Wind' as Wind,
        BusinessType,
        Description,
        NULL as TotalBound,
        NULL as TotalLost,
        NULL as TotalNTU,
        NULL as TotalQuoted

FROM    cte_Quotes
GROUP BY LineOfCoverage,BusinessType,Description
UNION ALL 
SELECT  NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
        LineOfCoverage,--CASE WHEN LineOfCoverage = 'Earthquake' THEN  'Earthquake' ELSE 'Wind' END as LineOfCoverage,
        'Earthquake' as Earthquake,
        'Wind' as Wind,
        'Grand Total' as BusinessType,
        --NULL,
        Description, -- description
        SUM(CASE WHEN  Description = 'Bound'        THEN [Bound Premium] ELSE 0 END) as TotalBound,
        SUM(CASE WHEN Description = 'Lost'          THEN [LostPremium] ELSE 0 END) as TotalLost,
        SUM(CASE WHEN  Description = 'Not Taken Up' THEN [NotTakenUpPremium] ELSE 0 END) as TotalNTU,
        SUM(CASE WHEN  Description = 'Quoted'       THEN [QuotedPremium] ELSE 0 END) as TotalQuoted
FROM    cte_Quotes
GROUP BY Description,LineOfCoverage,BusinessType    

要复制:

获取一些非常大的文本文件(不必为7)并使用上面的代码将它们全部转储到Text小部件中。然后用" ========================================双击该行=="最小化该文件中的所有文本。如果您最小化已打印的最后一个文件一切正常。如果你最小化第一个,你会在突出显示文本时看到响应缓慢,点击窗口中的任何位置等等。

什么时候发生了什么?' elide'设置为true导致这个?

我在使用pyinstaller创建一个exe后,从pycharm和另一台机器上测试了这个。

1 个答案:

答案 0 :(得分:2)

文本小部件目前正在进行完全重写和广泛测试。 Tcl / Tk版本8.7将提供具有更好的性能的新版本。

新版本的公告通常在comp.lang.tcl新闻组中进行。新版本也将在主网站上公布 http://www.tcl.tk/

不幸的是,由于人员和时间的限制,没有关于何时可以获得发布的估计。我的期望(猜测)是会有一个8.6.7错误修复版本,之后可能会有8.7。