Jan-20-2021, 02:18 PM
Self is not defined anywhere in your code
NameError: name 'self' is not defined
|
Jan-20-2021, 02:18 PM
Self is not defined anywhere in your code
Jan-20-2021, 02:42 PM
In which lines of this code:
https://github.com/Axel-Erfurt/OrthoView...iewLite.py do you fix the x,y coordinates? I am trying to change it in order to print real geographic x,y coordinates, meaning latitude and longitude gathered from the .tif file. Thanks...
Jan-23-2021, 11:01 PM
I just cut the code down to what I needed and used f-string.
I think the values come from matplotlib The original code is at line 109 (class MyToolBar) https://github.com/kklmn/OrthoView/blob/...thoView.py
Feb-16-2021, 05:42 PM
In this part of code:
class MyToolBar(mpl_qt.NavigationToolbar2QT): def set_message(self, s): try: sstr = s.split() while len(sstr) > 5: del sstr[0] x, y = float(sstr[0][2:]), float(sstr[1][2:]) s = f'x = {x:.2f}\ny = {y:.2f}' except Exception: pass if self.coordinates: self.locLabel.setText(s)what is the purpose of sstr? What does it do? Also what is the s? And why do we split it?
Feb-16-2021, 06:11 PM
Print s and print sstr and maybe you can figure it out by yourself
Feb-16-2021, 06:12 PM
s = coordinates
x=0.7338 y=0.952484 sstr splits into ['x=0.7338', 'y=0.952484'] x, y = float(sstr[0][2:]), float(sstr[1][2:])result is what you see on the toolbar label
Thanks!! And what is the purpose of this command?
while len(sstr) > 5:
Feb-16-2021, 07:58 PM
(This post was last modified: Feb-16-2021, 08:46 PM by deanhystad.)
If you actually looked at what is stored in sstr you might have a clue about why some of the manipulations need to occur. If you keep asking question after question you are never going to learn how to analyze code yourself and it is going to grind your development to a halt.
Feb-16-2021, 08:21 PM
Ok...
|
|
Possibly Related Threads… | |||||
Thread | Author | Replies | Views | Last Post | |
[Kivy] NameError: name 'App' is not defined | nengkya | 4 | 13,630 |
Apr-02-2017, 07:15 PM Last Post: metulburr |
|
[WxPython] NameError: global name 'PyAssertionError' is not defined | merlem | 5 | 6,254 |
Jan-28-2017, 01:59 PM Last Post: merlem |