我正在尝试使用PIL.Image
包和tkinter
来设置图像的Alpha值。这是我的代码。
background_image = Image.open(file_path + "\\static\\backgroundimage.jpg")
background_image = background_image.putalpha(128)
background_photo = ImageTk.PhotoImage(background_image)
background_label = tkinter.Label(dashboard_page, image=background_photo)
background_label.background_image = background_photo
background_label.place(x=0, y=0, relwidth=1, relheight=1)
该错误发生在第二行。 background_image = background_image.putalpha(128)
。如果我注释掉这一行,程序将正常运行并显示图像。但是,如果我取消注释此行,则会出现此错误。 AttributeError: 'PhotoImage' object has no attribute '_PhotoImage__photo'
。怎么回事,我该如何解决?谢谢。我正在使用Python 3.4.4。
答案 0 :(得分:1)
这里的问题是select '%' || 10 * (level - 1) val_disp,
(level - 1) / 10 val_ret
from dual
connect by level <= (1 - (:LOV_1 + :LOV_2)) * 10 + 1;
直接更改图像并返回import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { Routes, RouterModule } from '@angular/router';
import {NgbModule} from '@ng-bootstrap/ng-bootstrap';
import {FacilitistatusComponent} from './facilitistatus.component';
const routes: Routes = [{
path: '',
data: {
title: '',
urls: [{title: 'Dashboard',url: '/dashboard1'},{title: 'Facility Status'}]
},
component: FacilitistatusComponent
}];
@NgModule({
imports: [
FormsModule,
CommonModule,
RouterModule.forChild(routes),
NgbModule
],
declarations: [FacilitistatusComponent]
})
export class FacilitistatusModule{ }
,而不是新图像。因此,要修复代码,只需替换
.putalpha
通过
None
它应该可以工作。