我正在尝试为分配创建程序,以从字符串向量中添加和删除字符串,但是首先我需要创建一个函数来查找向量中是否已经存在该字符串。
我已经尝试使用循环搜索向量以在每个索引处找到特定的所需字符串。我尝试添加import tkinter as ttk
from datetime import datetime
from PIL import ImageTk,Image
root = ttk.Tk()
root.geometry("800x600")
root.title("New window")
# -------------get date information---------- #
now = datetime.now()
dt_string = now.strftime("%m/%y")
# grab image
imagepath = "D:\\Programing\\BG_sky.jpg"
background_picture = ImageTk.PhotoImage(Image.open(imagepath))
# ------------build window ------------------#
date = ttk.Label(root,text=dt_string,font='helvetica')
# date.pack(side="left")
date.place(x=10,y=10)
backgroundimage = ttk.Label(root,image=background_picture)
backgroundimage.pack(side="bottom",fill="both",expand="yes")
root.mainloop()
以退出该字符串(如果找到)。我不知道该函数应该为空还是布尔值。
break;
如果找到了字符串,我希望输出为true,否则显然会为false。
编辑:我忘了提到我也收到了警告:“并非所有控制路径都返回值”