ModuleNotFoundError: No module named 'tkfilebrowser'
ModuleNotFoundError: No module named 'tkfilebrowser'
我正在尝试使用代码制作 GUI,但我一直收到错误 ModuleNotFoundError:没有名为 'tkfilebrowser' 的模块。
我在代码中遇到无法导入 'tkfilebrowser'.
的问题
from PIL import Image
import tkinter
import tkinter.ttk
from tkinter import filedialog
from tkfilebrowser import askopendirname, askopenfilename, asksaveasfilename
def gendat(data):#convert data into binary data
newd=[]
for i in data:
newd.append(format(ord(i),'08b'))
return newd
def modpix(pix,data):#To return the modified pixels
datalist=gendat(data)
lendata=len(datalist)
imdata=iter(pix)
for i in range(lendata):
pix=[value for value in next(imdata)[:3] + next(imdata)[:3] + next(imdata)[:3]]
for j in range(0,8):
if (datalist[i][j]=='0') and (pix[j]%2!=0):
if (pix[j]%2!=0):
pix[j]-=1
elif (datalist[i][j]=='1') and (pix[j]%2==0):
pix[j]-=1
#0 means keep reading; 1 means the message is over.
if i==lendata-1:
if pix[-1]%2==0:
pix[-1]-=1
else:
if pix[-1]%2!=0:
pix[-1]-=1
pix=tuple(pix)
yield pix[0:3]
yield pix[3:6]
yield pix[6:9]
def encode_enc(data):
s2=tkinter.Tk()
name=askopenfilename()
image=Image.open(name,'r')
global newimg
newimg=image.copy()
你好,根据 tkfilebrowser pypi 的描述,它是本机 tkinter 模块的替代品,需要单独安装尝试
pip install tkfilebrowser
我正在尝试使用代码制作 GUI,但我一直收到错误 ModuleNotFoundError:没有名为 'tkfilebrowser' 的模块。 我在代码中遇到无法导入 'tkfilebrowser'.
的问题from PIL import Image
import tkinter
import tkinter.ttk
from tkinter import filedialog
from tkfilebrowser import askopendirname, askopenfilename, asksaveasfilename
def gendat(data):#convert data into binary data
newd=[]
for i in data:
newd.append(format(ord(i),'08b'))
return newd
def modpix(pix,data):#To return the modified pixels
datalist=gendat(data)
lendata=len(datalist)
imdata=iter(pix)
for i in range(lendata):
pix=[value for value in next(imdata)[:3] + next(imdata)[:3] + next(imdata)[:3]]
for j in range(0,8):
if (datalist[i][j]=='0') and (pix[j]%2!=0):
if (pix[j]%2!=0):
pix[j]-=1
elif (datalist[i][j]=='1') and (pix[j]%2==0):
pix[j]-=1
#0 means keep reading; 1 means the message is over.
if i==lendata-1:
if pix[-1]%2==0:
pix[-1]-=1
else:
if pix[-1]%2!=0:
pix[-1]-=1
pix=tuple(pix)
yield pix[0:3]
yield pix[3:6]
yield pix[6:9]
def encode_enc(data):
s2=tkinter.Tk()
name=askopenfilename()
image=Image.open(name,'r')
global newimg
newimg=image.copy()
你好,根据 tkfilebrowser pypi 的描述,它是本机 tkinter 模块的替代品,需要单独安装尝试
pip install tkfilebrowser