我正试图在迪纳摩用IronPython2.7制作我的第一个WPF
为了避免捆绑图像,我尝试从web上提取它,然后似乎需要将其转换为不同类型的位图,这样我就可以将其插入WPF
如上所述,我得到了以下错误:“AttributeError:namespace#”对象的属性“FileStream”是只读的”
这是我代码的相关部分
logo = PictureBox()
myImage = System.Windows.Controls.Image()
bitmapImage = BitmapImage()
bitmapImage.BeginInit()
bitmapImage.UriSource = Uri("https://www.dyna-sco.co.uk/uploads/1/2/7/0/127043387/" + "dyna-sco-logo1_orig.png")
bitmapImage.EndInit()
myImage.Source = bitmapImage
stream = System.Windows.Media.Imaging.FileStream(bitmapImage.UriSource, FileMode.Open, FileAccess.Read, FileAccess.ReadWrite)
encoder = System.Windows.Media.Imaging.BmpBitmapEncoder()
encoder.Frames.Add(System.Windows.Media.Imaging.BitmapFrame.Create(bitmapImage))
encoder.Save(stream)
logo.Image = bitmapImage
非常感谢所有评论和想法(与代码的任何部分相关)。我现在正在黑暗中挣扎:)
我已经阅读了我能找到的每一篇文章,但没有一篇有用
干杯
标记
目前没有回答
相关问题 更多 >
编程相关推荐