Tkinter PanedWindow, LabelFrame & MessageBox



 

Tkinter PanedWindow

Sintax :

w= PanedWindow(master, options) 


Contoh :

# !/usr/bin/python3  

from tkinter import *  

def add():  

    a = int(e1.get())  

    b = int(e2.get())  

    leftdata = str(a+b)  

    left.insert(1,leftdata)  

  

w1 = PanedWindow()  

w1.pack(fill = BOTH, expand = 1)  

left = Entry(w1, bd = 5)  

w1.add(left)  

w2 = PanedWindow(w1, orient = VERTICAL)  

w1.add(w2)  

e1 = Entry(w2)  

e2 = Entry(w2)  

w2.add(e1)  

w2.add(e2)  

bottom = Button(w2, text = "Add", command = add)  

w2.add(bottom)  

mainloop() 


Tkinter LabelFrame

Sintax :

w = LabelFrame(top, options)


Contoh :

# !/usr/bin/python3  

from tkinter import *  

top = Tk()  

top.geometry("300x200")  

labelframe1 = LabelFrame(top, text="Positive Comments")  

labelframe1.pack(fill="both", expand="yes")  

toplabel = Label(labelframe1, text="Place to put the positive comments")  

toplabel.pack()  

labelframe2 = LabelFrame(top, text = "Negative Comments")  

labelframe2.pack(fill="both", expand = "yes")  

bottomlabel = Label(labelframe2,text = "Place to put the negative comments")  

bottomlabel.pack()  

top.mainloop() 



Tkinter MessageBox

Sintax :

messagebox.function_name(title, message [, options]) 


Contoh :

# !/usr/bin/python3  

from tkinter import *  

from tkinter import messagebox  

top = Tk()  

top.geometry("100x100")      

messagebox.showinfo("information","Information")  

top.mainloop()