viewer.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:pinder 作者: dhharris 项目源码 文件源码
def onChangeLoc(self, event):
        '''
        Change location
        '''
        loc_set = False
        while not loc_set:
            dlg = wx.TextEntryDialog(self.frame, 'Please enter a location', 'Current location: ' + self.location)
            if dlg.ShowModal() == wx.ID_OK:
                # do something here
                loc = str(dlg.GetValue())
            else:
                # handle dialog being cancelled or ended by some other button
                loc = None

            dlg.Destroy()

            geolocator = Nominatim()
            # Look up location given
            try:
                l = geolocator.geocode(loc, exactly_one=True)
                self.latlon = (l.latitude, l.longitude)
                self.location = loc
                loc_set = True

            except Exception as e:
                print('Error setting location\n' + str(e))
        self.session.update_location(self.latlon[0], self.latlon[1])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号