1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
| import sys
if sys.version_info[0] >= 3:
import PySimpleGUI as sg
else:
import PySimpleGUI27 as sg
def GetInputString(window,key):
return window.FindElement(key).Get()
def GetInputNumber(window,key):
value = 0
try:
value = int(window.FindElement(key).Get())
except:
pass
return value
def SetMultilineNoWrap(window,key):
window.FindElement(key).TKText.configure(wrap='none')
def GetRadioName(window,key):
return window.FindElement(key).Text
def GetRadioSelectedIndex(window,key):
return int(window.FindElement(key).TKIntVar.get())
def ShowImagePopup(imageFile,title):
image_layout = [[sg.Image(filename=imageFile)]]
image_window = sg.Window(title).Layout(image_layout)
image_window.Show()
image_window.Read()
image_window.Close()
def CopyToClipboard(s):
import tkinter
r = tkinter.Tk()
r.withdraw()
r.clipboard_clear()
r.clipboard_append(s)
r.update()
r.destroy()
def ShowImagePopupTk(imageFile):
import tkinter
form = tkinter.Tk()
form.title("Image Viewer")
form.geometry("640x400+100+100")
form.resizable(False, False)
menubar=tk.Menu(form)
menu=tk.Menu(menubar, tearoff=0)
menu.add_command(label="About")
menu.add_separator()
menu.add_command(label="Exit")
menubar.add_cascade(label="File", menu=menu)
toplevel = tk.Toplevel(form, menu=menubar)
toplevel.geometry("320x200+820+100")
photo = tk.PhotoImage(imageFile)
label = tk.Label(form, image=photo, width= photo.width(), height=photo.height(), bd=4)
label.pack(side=tk.LEFT, padx=8, pady=8)
form.mainloop()
|
댓글 없음:
댓글 쓰기