Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 52926af

Browse files
exam updated
1 parent 9a25b39 commit 52926af

18 files changed

+232
-1
lines changed

‎.gitignore‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
# Ignore databaseUpdate.key file
22
databaseUpdate.key
33
TKInterface.key
4-
python_tutorial.pdf
4+
python_tutorial.pdf
5+
File Handling.ppt
6+
database update.ppt
7+
TKInterface.ppt

‎GUI Programming/1. Intro.py‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import tkinter
2+
top = tkinter.Tk()
3+
top.title("Hello World")
4+
5+
top.mainloop()

‎GUI Programming/10. Message.py‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from tkinter import *
2+
3+
root = Tk()
4+
5+
L1 = Message(root, text="Hello World")
6+
L1.pack()
7+
8+
root.mainloop()

‎GUI Programming/11. RadioButton.py‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from tkinter import *
2+
3+
def sel():
4+
selection = "You selected the option " + str(var.get())
5+
label.config(text = selection)
6+
7+
root = Tk()
8+
9+
var = IntVar()
10+
R1 = Radiobutton(root, text="Option 1", variable=var, value=1, command=sel)
11+
R1.pack( anchor = W )
12+
R2 = Radiobutton(root, text="Option 2", variable=var, value=2, command=sel)
13+
R2.pack( anchor = W )
14+
R3 = Radiobutton(root, text="Option 3", variable=var, value=3, command=sel)
15+
R3.pack( anchor = W)
16+
17+
label = Label(root)
18+
label.pack()
19+
root.mainloop()

‎GUI Programming/12. Scale.py‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
from tkinter import *
2+
def sel():
3+
selection = "Value = " + str(var.get())
4+
label.config(text = selection)
5+
6+
root = Tk()
7+
var = DoubleVar()
8+
scale = Scale( root, variable = var )
9+
scale.pack(anchor=CENTER)
10+
11+
button = Button(root, text="Get Scale Value", command=sel)
12+
button.pack(anchor=CENTER)
13+
14+
label = Label(root)
15+
label.pack()
16+
root.mainloop()

‎GUI Programming/2. Button.py‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from tkinter import *
2+
from tkinter import messagebox
3+
top = Tk()
4+
top.geometry("500x500")
5+
def helloCallBack():
6+
messagebox.showinfo( "Hello Python", "Hello World2")
7+
B = Button(top, text ="Hello", command = helloCallBack)
8+
B.pack()
9+
top.mainloop()

‎GUI Programming/3. Canvas.py‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from tkinter import *
2+
from tkinter import messagebox
3+
top = Tk()
4+
C = Canvas(top, bg = "blue", height = 250, width = 300)
5+
6+
coord = 10, 50, 240, 210
7+
arc = C.create_arc(coord, start = 0, extent = 290, fill = "red")
8+
9+
C.pack()
10+
top.mainloop()

‎GUI Programming/4. CheckBox.py‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from tkinter import *
2+
3+
top = Tk()
4+
CheckVar1 = IntVar()
5+
CheckVar2 = IntVar()
6+
C1 = Checkbutton(top, text = "Option 1", variable = CheckVar1, onvalue = 1, offvalue = 0, height=5, width = 20)
7+
C2 = Checkbutton(top, text = "Option 2", variable = CheckVar2, onvalue = 1, offvalue = 0, height=5, width = 20)
8+
C1.pack()
9+
C2.pack()
10+
top.mainloop()

‎GUI Programming/5. Entry.py‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
from tkinter import *
2+
3+
top = Tk()
4+
5+
L1 = Label(top, text="User Name")
6+
L1.grid(row=0, column=0)
7+
L2 = Label(top, text="Password")
8+
L2.grid(row=1, column=0)
9+
10+
E1 = Entry(top, bd=5)
11+
E1.grid(row=0, column=1)
12+
E2 = Entry(top, bd=5)
13+
E2.grid(row=1, column=1)
14+
15+
top.mainloop()

‎GUI Programming/6. Frame.py‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
from tkinter import *
2+
3+
root = Tk()
4+
frame = Frame(root)
5+
frame.pack()
6+
7+
bottomframe = Frame(root)
8+
bottomframe.pack( side = BOTTOM )
9+
10+
redbutton = Button(frame, text="Red", fg="red")
11+
redbutton.pack( side = LEFT)
12+
13+
greenbutton = Button(frame, text="Brown", fg="brown")
14+
greenbutton.pack( side = LEFT )
15+
16+
bluebutton = Button(frame, text="Blue", fg="blue")
17+
bluebutton.pack( side = LEFT )
18+
19+
blackbutton = Button(bottomframe, text="Black", fg="black")
20+
blackbutton.pack( side = BOTTOM)
21+
22+
root.mainloop()

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /