At command propmpt: pip install pillow
dropdown menu
1.read multiple files and process line by line parallel
2.menustrip
3.check file exists or not
4.Create exe from mutiple python files and images-cxfreeze
5.Solved:install pip in python3.3 or 2.6,.3.2
6.Easy way for object detection-take 5 minutes to set up
7.Set dimension and position of frame of python gui
8.Solved:Can't find python at command prompt
9.Count number of repeated words in a file
10.python gui - Change image immediately with mouse click on image
11.python gui - change image immediately click on button
12.python enumerate concept
13.python-match word in a file not single character
14.Python-match character and delete it
15.python-get x,y location of an image
16.python-crop certain dimension from image
17.Solved python tkinter error- couldn't recognize data in image file
18.python- control android camera
19.python- run mutiple program in one run(parallel processing)
20.Lauch python script at startup automatically
21.python tkinter- close,minimize,maximize off
22.python-count repeated word in a file
23.python tkinter-Progress bar
24.python-zoom in zoom out image
25.Python tkinter- Screen1 appear on top or bottom screen 2
26.python tkinter-update label while program running (progress bar from 0% to 100%)
27.Python tkinter - video preview in label
28.python-resize image
29.No module named cv2 solved
30.Install free python IDE for window
31.No module named PIL solved
32.Python tkinter - textbox
33.python - table generation in pdf using python
34.Solved: UnicodeEncodeError: 'charmap' codec can't encode characters
35.Python - Read open excel file data
36.Python tkinter -print preview
37.Solved: AttributeError_ type object 'Image' has no attribute 'open'
Saturday, April 11, 2020
No module named cv2 solved
No module named cv2 solved.
At command prompt type: pip install opencv-python.
Saturday, March 21, 2020
python-resize image
we can resize image using cv2 module.
Python code:
import cv2
img = cv2.imread('/home/pi/Desktop/download.jpeg') #read the image
width = int(1280 * 0.5) #width to resize
height = int(720 * 0.5) #height to resize
dim = (width, height)
resized = cv2.resize(img, dim, interpolation=cv2.INTER_AREA) #using API of cv2 resize
cv2.imwrite('/home/pi/Desktop/download_resize.jpg',resized) #then use cv2 to write out image
original image:
resized image:
Python code:
import cv2
img = cv2.imread('/home/pi/Desktop/download.jpeg') #read the image
width = int(1280 * 0.5) #width to resize
height = int(720 * 0.5) #height to resize
dim = (width, height)
resized = cv2.resize(img, dim, interpolation=cv2.INTER_AREA) #using API of cv2 resize
cv2.imwrite('/home/pi/Desktop/download_resize.jpg',resized) #then use cv2 to write out image
original image:
resized image:
Friday, January 3, 2020
Python tkinter - video preview in label
Video preview by using python tkinter.
Python code:
from tkinter import *
from PIL import ImageTk, Image
import cv2
root2=Tk()
root2.title('Video preview')
#Layout of display
topFrame =Frame(root2,width=100,height=100)
topFrame.grid(rowspan=2)
#topFrame
lmain = Label(topFrame,width=600,height=500)
lmain.grid()
cap=cv2.VideoCapture(0)
def video_stream():
_, frame = cap.read()
cv2image = cv2.cvtColor(frame, cv2.COLOR_BGR2RGBA)
img = Image.fromarray(cv2image)
imgtk = ImageTk.PhotoImage(image=img)
lmain.imgtk = imgtk
lmain.configure(image=imgtk)
lmain.after(1, video_stream)
video_stream()
root2.mainloop()
Friday, December 20, 2019
python tkinter-update label while program running (progress bar from 0% to 100%)
python tkinter update label while program running (progress bar from 0% to 100%)
Update continuously even you have button and button is clicked.
Just put config text and root.update() inside function def.
The progress bar:
Program:
from tkinter import *
import time
root=Tk()
a=Label(root,fg="blue")
a.pack()
def run():
a.config(text="processing 10%")
root.update()
time.sleep(1)
#program
a.config(text="processing 30%")
root.update()
time.sleep(1)
#program
a.config(text="processing 60%")
root.update()
time.sleep(1)
#program
a.config(text="processing 100%")
root.update()
time.sleep(1)
b=Button(root,text="run",command=run)
b.pack()
root.mainloop()
Update continuously even you have button and button is clicked.
Just put config text and root.update() inside function def.
The progress bar:
Program:
from tkinter import *
import time
root=Tk()
a=Label(root,fg="blue")
a.pack()
a.config(text="processing 10%")
root.update()
time.sleep(1)
#program
a.config(text="processing 30%")
root.update()
time.sleep(1)
#program
a.config(text="processing 60%")
root.update()
time.sleep(1)
#program
a.config(text="processing 100%")
root.update()
time.sleep(1)
root.mainloop()
Python tkinter update label progress bar while button is clicked.
The progress bar(with button):
from tkinter import *
import time
root=Tk()
a=Label(root,fg="blue")
a.pack()
def run():
a.config(text="processing 10%")
root.update()
time.sleep(1)
#program
a.config(text="processing 30%")
root.update()
time.sleep(1)
#program
a.config(text="processing 60%")
root.update()
time.sleep(1)
#program
a.config(text="processing 100%")
root.update()
time.sleep(1)
b=Button(root,text="run",command=run)
b.pack()
root.mainloop()
Sunday, December 8, 2019
Python tkinter- Screen1 appear on top or bottom screen 2
Python code:
Page1.py:
import tkinter as tk
import os
root = tk.Tk()
root.attributes('-type', 'dock')
root.title('top')
#root.attributes('-type', 'splash')
root.geometry('200x200+100+100')
def open():
os.system('python3 top2')
a=tk.Button(root,text="open screen 2",command=open)
a.pack()
root.mainloop()
Page2.py:
import tkinter as tk
root = tk.Tk()
root.title('top2')
root.geometry('200x200+150+150')
root.mainloop()
Screen 2 appear on top screen 1(dock):
Screen 2 appear on bottom screen 1(splash):
Video:
Subscribe to:
Posts (Atom)