小编Cso*_*gor的帖子

如何在GTK中更新绘图区域

我正试图在python 2中使用GTK制作一个时钟.我现在的版本只是一个基本版本,它会复杂得多,但我需要先刷新它.最后,它将成为一个屏幕保护程序,希望如此.

我试图理解queue_draw()是如何工作的,但我无法弄明白.我是GTK的新手,没有使用过类的经验(尽管我正在尝试).我想这两个都是我的问题所在.有人可以帮我这部分请:D我知道有关于这个问题的帖子,我仍然无法弄清楚如何使这个工作:(谢谢

我正在使用Ubuntu 14.04,python 2.

这是我目前的代码:

#!/usr/bin/env python
import time
import gtk
import math

class Base:
    def destroy(self, widget, data=None):
        gtk.main_quit()

    def close(self, widget):
        self.window.destroy()

    def rotate(self, center, point, angle):
        #http://stackoverflow.com/questions/12161277/how-to-rotate-a-vertex-around-a-certain-point
        px = point[0]
        py = point[1]
        rx = center[0] + (px - center[0]) * math.cos(math.radians(angle)) - (py - center[1]) * math.sin(math.radians(angle))
        ry = center[1] + (px - center[0]) * math.sin(math.radians(angle)) + (py - center[1]) * math.cos(math.radians(angle))
        return(rx, ry)

    # This function will be called whenever the drawing area …
Run Code Online (Sandbox Code Playgroud)

python gtk python-2.7

2
推荐指数
1
解决办法
737
查看次数

标签 统计

gtk ×1

python ×1

python-2.7 ×1