zjohn4
0
Q:

entry tkinter w3schools

# check this code first.
from tkinter import *

app = Tk()
# The title of the project
app.title("The title of the project")
# The size of the window
app.geometry("400x400")

# Defining a funtion
def c():
    # Label
    m = Label(app, text="Text")
    m.pack()


# Button
l = Button(app, text="The text of the Butoon", command=c)
# Packing the Button
l.pack()
app.mainloop()
# Quick Note : 
# When you put a command you should not use parentheses
# l = Button(app, text="The text of the Butoon", command=c)
# l = Button(app, text="The text of the Butoon", command=c())



# Ranuga
# Thank you.....
16
import tkinter as tk
from tkinter import *
from tkinter import ttk

class karl( Frame ):
    def __init__( self ):
        tk.Frame.__init__(self)
        self.pack()
        self.master.title("Karlos")
        self.button1 = Button( self, text = "CLICK HERE", width = 25,
                               command = self.new_window )
        self.button1.grid( row = 0, column = 1, columnspan = 2, sticky = W+E+N+S )
    def new_window(self):
        self.newWindow = karl2()
class karl2(Frame):     
    def __init__(self):
        new =tk.Frame.__init__(self)
        new = Toplevel(self)
        new.title("karlos More Window")
        new.button = tk.Button(  text = "PRESS TO CLOSE", width = 25,
                                 command = self.close_window )
        new.button.pack()
    def close_window(self):
        self.destroy()
def main(): 
    karl().mainloop()
if __name__ == '__main__':
    main()
0

New to Communities?

Join the community