免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1186 | 回复: 0
打印 上一主题 下一主题

我在寫一個簡單的 時鐘+Menu有點小問題想請教你們的!! [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2012-01-05 19:26 |只看该作者 |倒序浏览
from tkinter import *
import time

class TimeMenu(Frame):
    def __init__(self, parent=None):
        Frame.__init__(self, parent)
        self.pack()
        self.times()
        
    def times(self):
        newtime   = time.strftime('%p : %I :%M:%S')
        newday    = time.strftime('%Y-%m-%d', time.localtime(time.time()))
        timelabel = Label(self, text=newtime)
        daylabel  = Label(self, text=newday)
        timelabel.config(font=('courier', 20, 'bold italic'))
        timelabel.config(fg='green', bg='black')
        daylabel .config(font=('courier', 20, 'bold italic'))
        daylabel .config(fg='green', bg='black')
        timelabel.after(200, self.times)
        timelabel.pack()
        daylabel .pack()
        
        
      
   
    '''def makemenu(parent)
        menubar = Frame(parent)
        menubar.pack(side=TOP, fill=X)

        obutton = Menubutton(menubar, text='Option',            underline=0)
        obutton.pack(side=LEFT)
        option = Menu(obutton)
        option.add_command(label='Seletion Foreground Color', underline=0)
        option.add_command(label='Seletion Background Color', underline=0)
        obutton.config(menu=option)'''

if __name__ == '__main__':
    TimeMenu().mainloop()

目前最大問是 timelabel.after 運行不太正常該如何解決??
http://i623.photobucket.com/albums/tt318/ppgg9960/2.png
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP