Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import wx, requests, urllib.request
- class Test(wx.Frame):
- def __init__(self, parent, id):
- wx.Frame.__init__(self, parent, id, "Test App", (800, 800))
- self.panel = wx.Panel(self)
- self.panel.SetBackgroundColour("#FFFFFF")
- self.Centre()
- #show local image
- '''self.image = wx.Image("Untitled.png", wx.BITMAP_TYPE_ANY)
- self.imageBitmap = wx.StaticBitmap(self.panel, wx.ID_ANY, wx.Bitmap(self.image))'''
- #show image from URL
- self.URL = "https://maps.googleapis.com/maps/api/staticmap?center=Brooklyn+Bridge,New+York,NY&zoom=13&size=600x300&maptype=roadmap&markers=color:blue%7Clabel:S%7C40.702147,-74.015794&markers=color:green%7Clabel:G%7C40.711614,-74.012318"
- urllib.request.urlretrieve(self.URL, "image.jpg")
- self.image = wx.Image("image.jpg", wx.BITMAP_TYPE_ANY)
- self.imageBitmap = wx.StaticBitmap(self.panel, wx.ID_ANY, wx.Bitmap(self.image))
- def main():
- app = wx.App()
- frame = Test(None, -1)
- frame.Show()
- app.MainLoop()
- if __name__ == "__main__":
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement