Hi All,
i need to convert this Python code to C# .Tried Some online converters nothing Worked out so far.Please Help.
import openpyxl
from PIL import Image, ImageTk
import Tkinter as tk
import subprocess
import time
import os
import RPi.GPIO as IO
import sys
import glob
def Image_dis(img, delay):
root = tk.Tk()
root.overrideredirect(1)
root.geometry("{0}x{1}+0+0".format(root.winfo_screenwidth(), root.winfo_screenheight()))
image = Image.open(img)
copy_of_image = image.copy()
photo = ImageTk.PhotoImage(image)
label = tk.Label(root, image = photo)
label.bind('<Configure>', resize_image)
label.pack()
root.after(delay*1000,lambda: root.destroy())
root.mainloop()
def resize_image(event):
new_width = event.width
new_height = event.height
image = copy_of_image.resize((new_width, new_height))
photo = ImageTk.PhotoImage(image)
label.config(image = photo)
label.image = photo
def Video_dis(vid):
a = subprocess.call(["omxplayer","-b", vid])
path = '/mnt/'
##pid = subprocess.Popen([sys.executable, "resize.py"])
##root = tk.Tk()
##x = root.winfo_screenwidth()
##y = root.winfo_screenheight()
##for img in glob.glob(os.path.join(path,'*.jpg')):
## im = Image.open(img)
## im = im.resize((x,y), Image.ANTIALIAS)
## im.save(img)
for i in range(0,2):
## pid = subprocess.Popen([sys.executable, "black.py"])
file1 = openpyxl.load_workbook(path+"MANDFILEBF.xlsx")
sheet1 = file1.get_sheet_by_name('Sheet1')
j = sheet1.max_row
for k1 in range (1,j):
for k in range (2,j+1):
a=sheet1['C'+str(k)].value
if a == k1:
c1 = sheet1['A'+str(k)].value
print c1
if c1.endswith('jpg'):
img = path+c1
delay = sheet1['B'+str(k)].value
Image_dis(img, delay)
elif c1.endswith('mp4'):
vid = path+c1
Video_dis(vid)
break