I have tried the below code . Functionality-
I tried below but if the https://developers.facebook.com/apps/<YOUR_APP_ID>/marketing-api/settings/
before method call doesnot show image and if we comment from tkinter import *
from tkinter import filedialog
from PIL import Image, ImageTk
import cv2
import os
import glob
import numpy as np
image_path = ""
image_list = []
class Proj:
def __init__(self, master):
self.master = master
#GUI height and width
w = 1250
h = 600
# open folder manager to select image folder
image_path = filedialog.askdirectory()
master.geometry("%dx%d%+d%+d" % (w ,h ,0,0))
master.resizable(True,True)
#read in images from folder
self.read_images(master, image_path)
#cv2.imshow('image',cv2.imread(image_list[0], 1))
self.img = cv2.imread(image_list[0])
self.img = Image.fromarray(np.array(self.img).copy())
self.img.thumbnail((w//2, w//2+10))
self.img = ImageTk.PhotoImage(self.img)
image_frame = Frame(master)
image_frame.grid(row = 0, column = 0, columnspan = 3, rowspan = 5)
left_panel = Canvas(image_frame, width=w//2, height=h-70)
left_panel.grid(row=0, column=0, columnspan=4)
imgA_handler = left_panel.create_image((0,0), image = self.img, anchor="nw")
right_panel = Canvas(image_frame, width=w//2, height=h-70)
right_panel.grid(row=0, column=5, columnspan=4)
def read_images(self, master, path):
images = path + '/*.tif'
for img in glob.glob(images): #will only read in tif images
image_list.append(img)
root = Tk()
example = Proj(root)
root.mainloop()
then it shows loader image after method is finished.
Will left_panel.
method not apply the visibility to Label unless it completes? If yes is there any alternative for this problem?
loaderLabel1.setVisible(true);
答案 0 :(得分:1)
There is the class SwingWorker that allows you to perform Tasks in a different thread; here's an example of how your code could be changed to use a SwingWorker:
C:\Users\Morgan\Desktop\testingGrounds>node createMongoDB.js
C:\Users\Morgan\Desktop\testingGrounds\node_modules\mongodb\lib\mongo_client.js:421
throw err
^
[object Object]
Note the methods doInBackground() that does the work in the other thread and done() that is called after doInBackground() is finished.