Because it is not a specifc Turtle discussion any more, I started this new discussion. The previous discussion is readable in:
https://discuss.python.org/t/turtle-doesnt-show-window-in-full-format-in-linux-fedora/35546/21
In the mean time I have changed the Worldmap by the suggested Blue Marble Earth Image and made the necessary adjustments. I also add more info of the actual ISS position. The last code is now:
import json
import turtle
import time
import tkinter
import urllib
import urllib.request
from tkinter import *
from turtle import RawTurtle, TurtleScreen
from datetime import datetime
url = 'http://api.open-notify.org/iss-now.json'
response = urllib.request.urlopen(url)
result = json.loads(response.read())
print(result, '\n')
location = result['iss_position']
lat = location['latitude']
lon = location['longitude']
print('latitude: ', lat)
print('longitude:', lon)
lat = float(lat)
lon = float(lon)
win = tkinter.Tk()
win.title('ISS Location')
width_value = win.winfo_screenwidth()
height_value = win.winfo_screenheight()
print(width_value)
print(height_value)
canv = tkinter.Canvas(master = win, width = 876, height = 438)
canv.grid(row = 0, column = 0)
screen = TurtleScreen(canv)
screen.bgpic('worldmap.gif')
x0 = 7 # zero point corrections
y0 = -7
my_turtle = turtle.RawTurtle(screen)
# ISS-point coordinates
my_turtle.goto(x0 + lon * 2.4, y0 + lat * 2.2) # draw corrections
# ISS-point
my_turtle.fillcolor('red')
my_turtle.begin_fill()
my_turtle.circle(10)
my_turtle.end_fill()
style = ('Arial', 15, 'bold')
# zero point and ISS-location information
my_turtle.goto(x0, y0)
now = datetime.now()
dt_string = now.strftime("%d/%m/%Y %H:%M:%S")
print("date and time =", dt_string)
my_turtle.color('yellow')
my_turtle.write('Lat^ ' + str(lat)
+ '\n' + 'Lon> ' + str(lon) + '\n' + dt_string, font=style)
win.mainloop()
But I have please one remark or question for the presentation.
From IDLE, I have no problem to run it, but it doesn’t run from the terminal.
I receive the following error, I suppose I can not run it from terminal?
gastonv@localhost Python_The_Bible]$ python3 isslocation.py
Traceback (most recent call last):
File "/home/gastonv/Programmeren/Python_The_Bible/isslocation.py", line 8, in <module>
import urllib.request
File "/usr/lib64/python3.11/urllib/request.py", line 88, in <module>
import http.client
File "/usr/lib64/python3.11/http/client.py", line 71, in <module>
import email.parser
File "/usr/lib64/python3.11/email/parser.py", line 12, in <module>
from email.feedparser import FeedParser, BytesFeedParser
File "/usr/lib64/python3.11/email/feedparser.py", line 27, in <module>
from email._policybase import compat32
File "/usr/lib64/python3.11/email/_policybase.py", line 9, in <module>
from email.utils import _has_surrogates
File "/usr/lib64/python3.11/email/utils.py", line 28, in <module>
import random
File "/home/gastonv/Programmeren/Python_The_Bible/random.py", line 5, in <module>
print(random.random())
^^^^^^^^^^^^^^^
TypeError: 'module' object is not callable