37,719
社区成员
发帖
与我相关
我的任务
分享
#!/usr/bin/env python
#-*- coding:utf-8 -*-
import os, sys
if sys.version_info[0] == 2:
from Tkinter import *
from tkFont import Font
from ttk import *
#Usage:showinfo/warning/error,askquestion/okcancel/yesno/retrycancel
from tkMessageBox import *
#Usage:f=tkFileDialog.askopenfilename(initialdir='E:/Python')
#import tkFileDialog
#import tkSimpleDialog
else: #Python 3.x
from tkinter import *
from tkinter.font import Font
from tkinter.ttk import *
from tkinter.messagebox import *
#import tkinter.filedialog as tkFileDialog
#import tkinter.simpledialog as tkSimpleDialog #askstring()
class Application_ui(Frame):
#这个类仅实现界面生成功能,具体事件处理代码在子类Application中。
def __init__(self, master=None):
Frame.__init__(self, master)
self.master.title('Form1')
self.master.geometry('389x339')
self.createWidgets()
def createWidgets(self):
self.top = self.winfo_toplevel()
self.style = Style()
self.TabStrip1 = Notebook(self.top)
self.TabStrip1.place(relx=0.062, rely=0.071, relwidth=0.887, relheight=0.876)
self.TabStrip1__Tab1 = Frame(self.TabStrip1)
self.TabStrip1__Tab1Lbl = Label(self.TabStrip1__Tab1, text='Please add widgets in code.')
self.TabStrip1__Tab1Lbl.place(relx=0.1,rely=0.5)
self.TabStrip1.add(self.TabStrip1__Tab1, text='我的快玩')
self.TabStrip1__Tab2 = Frame(self.TabStrip1)
self.TabStrip1__Tab2Lbl = Label(self.TabStrip1__Tab2, text='Please add widgets in code.')
self.TabStrip1__Tab2Lbl.place(relx=0.1,rely=0.5)
self.TabStrip1.add(self.TabStrip1__Tab2, text='找游戏')
class Application(Application_ui):
#这个类实现具体的事件处理回调函数。界面生成代码在Application_ui中。
def __init__(self, master=None):
Application_ui.__init__(self, master)
if __name__ == "__main__":
top = Tk()
Application(top).mainloop()