Skip to content

Commit 385f5d9

Browse files
style: format code with autopep8
Format code with autopep8 This commit fixes the style issues introduced in 2b503c4 according to the output from Autopep8. Details: None
1 parent 3cdc106 commit 385f5d9

File tree

1 file changed

+28
-14
lines changed

1 file changed

+28
-14
lines changed

Image borders/Image_border.py

+28-14
Original file line numberDiff line numberDiff line change
@@ -2,53 +2,67 @@
22
import tkinter as tk
33
from tkinter.filedialog import *
44

5-
def choose_image(): # reading the image
5+
6+
def choose_image(): # reading the image
67
photo = askopenfilename()
78
global img
89
img = cv2.imread(photo)
9-
img = cv2.resize(img,(500,500))
10+
img = cv2.resize(img, (500, 500))
1011

1112
# functions for every border type
13+
14+
1215
def constant_border():
13-
bordered = cv2.copyMakeBorder(img,50,50,50,50,cv2.BORDER_CONSTANT)
16+
bordered = cv2.copyMakeBorder(img, 50, 50, 50, 50, cv2.BORDER_CONSTANT)
1417
cv2.imshow("Constant border", bordered)
1518
cv2.waitKey(0)
1619
cv2.destroyAllWindows()
1720

21+
1822
def reflection_border():
19-
bordered = cv2.copyMakeBorder(img,50,50,50,50,cv2.BORDER_REFLECT)
23+
bordered = cv2.copyMakeBorder(img, 50, 50, 50, 50, cv2.BORDER_REFLECT)
2024
cv2.imshow("Reflection border", bordered)
2125
cv2.waitKey(0)
2226
cv2.destroyAllWindows()
2327

28+
2429
def default_border():
25-
bordered = cv2.copyMakeBorder(img,50,50,50,50,cv2.BORDER_DEFAULT)
30+
bordered = cv2.copyMakeBorder(img, 50, 50, 50, 50, cv2.BORDER_DEFAULT)
2631
cv2.imshow("Default border", bordered)
2732
cv2.waitKey(0)
2833
cv2.destroyAllWindows()
2934

35+
3036
def replicate_border():
31-
bordered = cv2.copyMakeBorder(img,50,50,50,50,cv2.BORDER_REPLICATE)
37+
bordered = cv2.copyMakeBorder(img, 50, 50, 50, 50, cv2.BORDER_REPLICATE)
3238
cv2.imshow("Replicate border", bordered)
3339
cv2.waitKey(0)
3440
cv2.destroyAllWindows()
3541

42+
3643
def wrap_border():
37-
bordered = cv2.copyMakeBorder(img,50,50,50,50,cv2.BORDER_WRAP)
44+
bordered = cv2.copyMakeBorder(img, 50, 50, 50, 50, cv2.BORDER_WRAP)
3845
cv2.imshow("Wrap border", bordered)
3946
cv2.waitKey(0)
4047
cv2.destroyAllWindows()
4148

42-
window = tk.Tk() # displaying menu and options
49+
50+
window = tk.Tk() # displaying menu and options
4351
window.title("Borders on images")
4452
window.geometry('320x220')
45-
label = tk.Label(window, text="Select an image and then choose an option").grid(row=0, column=0)
46-
b = tk.Button(window, text="Choose image", command=choose_image).grid(row=1,column=0)
53+
label = tk.Label(window, text="Select an image and then choose an option").grid(
54+
row=0, column=0)
55+
b = tk.Button(window, text="Choose image",
56+
command=choose_image).grid(row=1, column=0)
4757

48-
rad1 = tk.Radiobutton(window, text='Constant border', value=1, command=constant_border)
49-
rad2 = tk.Radiobutton(window, text='reflection border', value=2, command=reflection_border)
50-
rad3 = tk.Radiobutton(window, text='default border', value=3, command=default_border)
51-
rad4 = tk.Radiobutton(window, text='replicate border', value=4, command=replicate_border)
58+
rad1 = tk.Radiobutton(window, text='Constant border',
59+
value=1, command=constant_border)
60+
rad2 = tk.Radiobutton(window, text='reflection border',
61+
value=2, command=reflection_border)
62+
rad3 = tk.Radiobutton(window, text='default border',
63+
value=3, command=default_border)
64+
rad4 = tk.Radiobutton(window, text='replicate border',
65+
value=4, command=replicate_border)
5266
rad5 = tk.Radiobutton(window, text='wrap border', value=5, command=wrap_border)
5367

5468
rad1.grid(row=2, column=0)

0 commit comments

Comments
 (0)