Sunday, September 24, 2017

Resize image dynamically when frame is maximized in wxPython


I will work you through on how you will "Resize a wxStaticBitmap image dynamically when frame is maximized in wxPython

Here I have two StaticBitmap images placed side-by-side in box sizers. So, we want the size of the images to scale appropriately with the frame whenever it is been maximized.

The code....

import wx

class MyFrame2 ( wx.Frame ):

    def __init__( self, parent ):
        wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = wx.EmptyString, pos = wx.DefaultPosition, size = wx.Size( 500,300 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL )

        self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )

        bSizer11 = wx.BoxSizer( wx.HORIZONTAL )

        self.m_bitmap3 = wx.StaticBitmap( self, wx.ID_ANY, wx.Bitmap( u"img/im1.jpg", wx.BITMAP_TYPE_ANY ), wx.DefaultPosition, wx.DefaultSize, 0 )
        bSizer11.Add( self.m_bitmap3, 1, wx.ALL|wx.EXPAND, 5 )

        self.m_bitmap4 = wx.StaticBitmap( self, wx.ID_ANY, wx.Bitmap( u"img/im2.jpg", wx.BITMAP_TYPE_ANY ), wx.DefaultPosition, wx.DefaultSize, 0 )
        bSizer11.Add( self.m_bitmap4, 1, wx.ALL|wx.EXPAND, 5 )

        self.SetSizer( bSizer11 )

        self.Centre( wx.BOTH )

    def __del__( self ):

app = wx.App(0)

When you first launch the GUI it is like this....

Thursday, September 14, 2017

The Geo in PyCon Nigeria 2017


I am privileged to be among the speakers at this year's python conference and the title of my talk is "Using Python for GIS and Remote Sensing Operations".

As I Geo aware individual, I was impressed with the organizers especially the guy behind the conference Venue page.

He did not only added geospatial technology on the page, but he also encouraged users to make use of the tool to make there live easier while locating the conference venue.

The web page is based on python Django web framework (Pinax/Symposion) and on these bases of python & GIS relationships, I decided to write this blog post.

What I did on the Venue Page

On the page there is a "Get Direction" tool, so i used it to get the direction from Abuja where I am coming from.

There and then I have a quick idea of where am going to and how long it will take me to reach there by road or air as seen above.

I also get the direction of my hotel (Presken Hotel) location to the venue and I observed there are two location of the hotel having similar name. However, based on the address provided I realized the correct on is with the name "Presken Hotel (Awolowo way)" and it is about 2km (5min drive) from the venue.

Thank God for Google map, everyone can at least do or interact with GIS without installing any heavy software.

You can find the presentation here: