日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > python >内容正文

python

python中mainloop什么意思_很难理解python中的Tkinter mainloop()

發布時間:2024/9/19 python 40 豆豆
生活随笔 收集整理的這篇文章主要介紹了 python中mainloop什么意思_很难理解python中的Tkinter mainloop() 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

好的,我有一個基本的窗口,有一個編輯和查看按鈕。按照我的代碼,EDIT和VIEW都會返回一條消息“這個按鈕沒用”。我在“主窗口”下創建了這些。我創建了另一個類“edit_window”,希望在單擊edit按鈕時調用它。本質上,單擊edit按鈕應該更改顯示帶有添加和刪除按鈕的新窗口。這是我目前為止的代碼…下一步的邏輯步驟是什么?在from Tkinter import *

#import the Tkinter module and it's methods

#create a class for our program

class main_window:

def __init__(self, master):

frame = Frame(master)

frame.pack(padx=15,pady=100)

self.edit = Button(frame, text="EDIT", command=self.edit)

self.edit.pack(side=LEFT, padx=10, pady=10)

self.view = Button(frame, text="VIEW", command=self.view)

self.view.pack(side=RIGHT, padx=10, pady=10)

def edit(self):

print "this button is useless"

def view(self):

print "this button is useless"

class edit_window:

def __init__(self, master):

frame = Frame(master)

frame.pack(padx=15, pady=100)

self.add = Button(frame, text="ADD", command=self.add)

self.add.pack()

self.remove = Button(frame, text="REMOVE", command=self.remove)

self.remove.pack()

def add(self):

print "this button is useless"

def remove(self):

print "this button is useless"

top = Tk()

top.geometry("500x500")

top.title('The Movie Machine')

#Code that defines the widgets

main = main_window(top)

#Then enter the main loop

top.mainloop()

總結

以上是生活随笔為你收集整理的python中mainloop什么意思_很难理解python中的Tkinter mainloop()的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。