# Help with my Python Program

Hi, I am an older individual learning Python using Pycharm and I am stuck with my output box. I don’t know how to print in the box. You can see the print arguments but I am at a loss. I wrote all of this code my self and I am a licensed Land Surveyor and that is what this program is all about, just a coordinate geometry program for two state plane coordinates (Georgia State Plane). Thank you, Bill
import math
import customtkinter
from geopy.distance import geodesic
from pyproj import Transformer

Az: float
Deg: int
Min: float
Sec: float
Az2: float
Az3: float
Az4: float
x1: float
y1: float
x2: float
y2: float
y3: float
y4: float

customtkinter.set_appearance_mode(“dark”)
customtkinter.set_default_color_theme(“blue”)

root = customtkinter.CTk()
root.geometry(“500x750”)

def Solve():
sta_1 = int(entry1.get())
sta_2 = int(entry2.get())
easting_1 = float(entry3.get())
northing_1 = float(entry4.get())
easting_2 = float(entry5.get())
northing_2 = float(entry6.get())
sum1 = float(northing_2 - northing_1)
sum2 = float(easting_2 - easting_1)
sum3 = float(sum1 ** 2 + sum2 ** 2) ** 0.50
sum4 = float(round(sum3, 5))
transformer = Transformer.from_crs(“epsg:2240”, “epsg:4326”)
(x1, y1) = transformer.transform(easting_1, northing_1)
(x2, y2) = transformer.transform(easting_2, northing_2)

``````root_p = customtkinter.CTk()
root_p.geometry("450x450")
label_p = customtkinter.CTkLabel(master=root_p, text="Coordinate Geometry Output")
label_p.pack()

print("Station One:= ", sta_1)
print("Station two:= ", sta_2)
print("Station One:= ", sta_1)
print("Latitude =: ", round(x1, 7), "Longitude =:", round(y1, 7))
Deg = int(x1)
Min = int((x1 - Deg) * 60)
Sec = ((x1 - (Deg + Min / 60)) * 3600)
print("Deg =:", Deg, "Min =:", Min, "Sec =:", round(Sec, 5))
y3 = abs(y1)
Deg = int(y3)
Min = int((y3 - Deg) * 60)
Sec = ((y3 - (Deg + Min / 60)) * 3600)
print("Deg =:", Deg, "Min =:", Min, "Sec =:", round(Sec, 5))
print("Station Two =:", sta_2)
print("Latitude =: ", round(x2, 7), "Longitude =: ", round(y2, 7))
Deg = int(x2)
Min = int((x2 - Deg) * 60)
Sec = ((x2 - (Deg + Min / 60)) * 3600)
print("Deg =:", Deg, "Min =:", Min, "Sec =:", round(Sec, 5))
y4 = abs(y2)
Deg = int(y4)
Min = int((y4 - Deg) * 60)
Sec = ((y4 - (Deg + Min / 60)) * 3600)
print("Deg =:", Deg, "Min =:", Min, "Sec =:", round(Sec, 5))
fst = (x1, y1)
snd = (x2, y2)
print("Geodesic distance =:", round(geodesic(fst, snd).km * 3280.83333333333, 5))
if sum1 == 0 and sum2 > 0:
print("Az =: ", 90)
print("Distance =: ", sum4)
exit()
if sum1 == 0 and sum2 < 0:
print("Az =: ", 270)
print("Distance =:", sum4)
exit()
if sum2 == 0 and sum1 > 0:
print("Az =: ", 360)
if sum2 == 0 and sum1 < 0:
print("Az =: ", 180)
Az = math.degrees(math.atan(sum2 / sum1))
print(sum2)
print(sum1)
if sum2 > 0 and sum1 > 0:
print("Az1 =: ", Az)
print("N ", int(Az), "E ")
Deg = int(Az)
Min = int((Az - Deg) * 60)
Sec = ((Az - (Deg + Min / 60)) * 3600)
print("Deg =:", Deg, "Min =:", Min, "Sec =:", round(Sec, 2))
elif sum2 > 0 and sum1 < 0:
print("Az2 =: ", 180 + Az)
Az2 = 180 + Az
Deg = int(Az2)
Min = int((Az2 - Deg) * 60)
Sec = ((Az2 - (Deg + Min / 60)) * 3600)
print("Deg =:", Deg, "Min =:", Min, "Sec =:", round(Sec, 2))
print("S ", abs(Az), "E ")
Deg = int(abs(Az))
Min = int((abs(Az) - Deg) * 60)
Sec = ((abs(Az) - (Deg + Min / 60)) * 3600)
print("Deg =:", Deg, "Min =:", Min, "Sec =:", round(Sec, 2))
elif sum2 < 0 and sum1 < 0:
print("Az3 =: ", 180 + Az)
Az3 = 180 + Az
Deg = int(Az3)
Min = int((Az3 - Deg) * 60)
Sec = ((Az3 - (Deg + Min / 60)) * 3600)
print("Deg =:", Deg, "Min =:", Min, "Sec =:", round(Sec, 2))
print("S ", Az, "W ")
Deg = int(Az)
Min = int((Az - Deg) * 60)
Sec = ((Az - (Deg + Min / 60)) * 3600)
print("Deg =:", Deg, "Min =:", Min, "Sec =:", round(Sec, 2))
elif sum2 < 0 and sum1 > 0:
print("Az4 =:", 360 + Az)
Az4 = 360 + Az
Deg = int(Az4)
Min = int((Az4 - Deg) * 60)
Sec = ((Az4 - (Deg + Min / 60)) * 3600)
print("Deg =:", Deg, "Min =:", Min, "Sec =:", round(Sec, 2))
print("N ", abs(Az), "W ")
Deg = int(abs(Az))
Min = int((abs(Az) - Deg) * 60)
Sec = ((abs(Az) - (Deg + Min / 60)) * 3600)
print("Deg =:", Deg, "Min =:", Min, "Sec =:", round(Sec, 2))
print("Distance =: ", sum4)
print(Az)
root_p.mainloop()
``````

def Clear():
entry1.delete(0, customtkinter.END)
entry2.delete(0, customtkinter.END)
entry3.delete(0, customtkinter.END)
entry4.delete(0, customtkinter.END)
entry5.delete(0, customtkinter.END)
entry6.delete(0, customtkinter.END)

frame = customtkinter.CTkFrame(master=root)

label = customtkinter.CTkLabel(master=frame, text=“Coordinate Geometry Inverse Program”)
label.pack()
label = customtkinter.CTkLabel(master=frame, text=“by William H Helbig PS”)
entry1 = customtkinter.CTkEntry(master=frame, placeholder_text=“Station One”)
entry2 = customtkinter.CTkEntry(master=frame, placeholder_text=“Station Two”)
entry3 = customtkinter.CTkEntry(master=frame, placeholder_text=“First Easting”)
entry4 = customtkinter.CTkEntry(master=frame, placeholder_text=“First Northing”)
entry5 = customtkinter.CTkEntry(master=frame, placeholder_text=“Second Easting”)
entry6 = customtkinter.CTkEntry(master=frame, placeholder_text=“Second Northing”)
button = customtkinter.CTkButton(master=frame, text=“solve”, command=Solve)
button = customtkinter.CTkButton(master=frame, text=“Clear All”, command=Clear)

root.mainloop()

Alright, I am new as well, and will do my best

``````def Solve():
sta_1 = int(entry1.get())
sta_2 = int(entry2.get())
-----------------------------------------------
print("Station One:= ", sta_1)
print("Station two:= ", sta_2)
``````

I am not sure if you gave entry1.get() a value, I could be quite wrong considering i am not sure how the code is supposed to operate. Also, i’m not sure if its needed in this type of programing, but you might(I stress might) need to add the dunder method ex—>

``````class solve():
def __init__(self):
self.sta_1 = int(entry1.get())------> initializing the variable
self.sta_2 = int(entry2.get())
def Solve():
print("Station One: = ", self.sta_1)-----> printing the string and variable
print("Station two: = ", self.sta_2)

``````

You would need to run the class or functions associated with the class in an area that updates when the program is ran. I’m not sure for this case at all, or for most of what I suggested here, since I am more into building games with python
My best advice, is don’t remove the code. But, open a new file, and start smaller, and try to get the print statement to print something simple, and work your way up from there

Guys, just a punctuation note. See how your code on the forum appears
largely unindented?

Please post code between “code fences”, a pair of lines with triple
backticks. Example:

`````` ```
goes here
```
``````

This preserves indentation and punctuation in the listing, which is
important. There’s a `</>` button in the message compose window to start
such a section.

Cheers,
Cameron Simpson cs@cskk.id.au

I tried to reply to William by email in response to an email he sent to me, but `outlook.com` told my mail server to go away. Bah!

Anyway, the forum is a better place for discussion. My reply now appended below.

I saw your reply for Python Help. Thank you for that. If I send you my code do you think you could help me with a minor issue.

It depends on the issue. But posting to the forum is usually better - you get an audience with varied backgrounds and knowledge, and onlookers get to learn from the discussion
if they care.

I can now have the solutions appear in an output box, but I can not
copy the contents from that output box so I can print them . I would
also like to have the option of printing the contents in that box as
well.