Skip to content
This repository was archived by the owner on Dec 8, 2021. It is now read-only.

Commit ce69489

Browse files
authored
Add files via upload
Added support for moving the window.
1 parent 3cf42ca commit ce69489

1 file changed

Lines changed: 27 additions & 85 deletions

File tree

Rails.py

Lines changed: 27 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@
2626
# Set up CurrentPoint. This keeps track of what point you're editing in the GUI.
2727
CurrentPoint = 0
2828

29+
#Set up window position
30+
WindowX = 587
31+
WindowY = 152
32+
2933
def CoreCalculation():
3034
#Grab all the needed variables
3135
global X
@@ -87,90 +91,6 @@ def CoreCalculation():
8791
clipboard.copy(FinalString)
8892
print(FinalString)
8993

90-
"""
91-
# GUI
92-
main = Tk()
93-
main.title("RailGen")
94-
main.geometry("500x500")
95-
96-
rows = 0
97-
98-
while rows < 50:
99-
main.rowconfigure(rows, weight=1)
100-
main.columnconfigure(rows, weight=1)
101-
rows += 1
102-
TabControl = ttk.Notebook(main)
103-
TabControl.grid(row = 1, column = 0, columnspan = 40, rowspan = 39, sticky = "NESW")
104-
Settings = ttk.Notebook(main)
105-
Settings.grid(row = 1, column = 40, columnspan = 10, rowspan = 49, sticky = "NESW")
106-
107-
108-
109-
CurrentTabCount = 0
110-
XEntry = []
111-
YEntry = []
112-
ZEntry = []
113-
#XCurrentEntry = ttk.Entry()
114-
#YCurrentEntry = ttk.Entry()
115-
#ZCurrentEntry = ttk.Entry()
116-
117-
118-
119-
120-
def AddTab():
121-
global CurrentTabCount
122-
global XEntry
123-
global YEntry
124-
global ZEntry
125-
NewTab = ttk.Frame(TabControl)
126-
TabControl.add(NewTab)
127-
XCurrentEntry = ttk.Entry(NewTab, text = "X").pack()
128-
YCurrentEntry = ttk.Entry(NewTab, text = "Y").pack()
129-
ZCurrentEntry = ttk.Entry(NewTab, text = "Z").pack()
130-
XEntry.append(XCurrentEntry.get())
131-
YEntry.append(YCurrentEntry.get())
132-
ZEntry.append(ZCurrentEntry.get())
133-
def Save():
134-
global XEntry
135-
global YEntry
136-
global ZEntry
137-
global X
138-
global Y
139-
global Z
140-
global XCurrentEntry
141-
global YCurrentEntry
142-
global ZCurrentEntry
143-
XEntry[CurrentTabCount] = XCurrentEntry.get()
144-
YEntry[CurrentTabCount] = YCurrentEntry.get()
145-
ZEntry[CurrentTabCount] = ZCurrentEntry.get()
146-
147-
print(CurrentTabCount)
148-
CurrentTabCount = CurrentTabCount + 1
149-
ttk.Button(NewTab, text = "Save", command = Save).pack()
150-
#def Save():
151-
#X.append(XEntry.get())
152-
#Y.append(YEntry.get())
153-
#Z.append(ZEntry.get())
154-
#print(X)
155-
#ttk.Button(NewTab, text="Save", command = Save).pack()
156-
157-
#XEntry = ttk.Entry(NewTab, text = "X")
158-
#XEntry.pack()
159-
160-
161-
Checkbutton(Settings, text = "IsClosed", variable = IsClosed).grid(row = 0, sticky = "W")
162-
Button(Settings, text = "Add new tab", command = AddTab).grid(row = 1, sticky = "W")
163-
164-
165-
166-
#X1 = ttk.Entry(point1, text = "text")
167-
#X1.pack()
168-
169-
170-
171-
main.mainloop()
172-
"""
173-
17494

17595

17696
import sys
@@ -226,7 +146,12 @@ def NextPoint():
226146
global X
227147
global Y
228148
global Z
149+
global WindowX
150+
global WindowY
229151
global HashID
152+
# This isn't needed for some reason.
153+
global root
154+
230155
print(CurrentPoint + 1)
231156
X[CurrentPoint] = int(top.XEntry.get())
232157
Y[CurrentPoint] = int(top.YEntry.get())
@@ -237,6 +162,8 @@ def NextPoint():
237162
if (CurrentPoint < len(X)-1):
238163
CurrentPoint = CurrentPoint + 1
239164
HashID = top.HashIDEntry.get()
165+
WindowX = root.winfo_x()
166+
WindowY = root.winfo_y()
240167
top = Toplevel1 (root)
241168

242169

@@ -246,7 +173,11 @@ def PrevPoint():
246173
global X
247174
global Y
248175
global Z
176+
global WindowX
177+
global WindowY
249178
global HashID
179+
# This isn't needed for some reason.
180+
global root
250181

251182
print(CurrentPoint + 1)
252183
X[CurrentPoint] = int(top.XEntry.get())
@@ -258,6 +189,8 @@ def PrevPoint():
258189
if (CurrentPoint > 0):
259190
CurrentPoint = CurrentPoint - 1
260191
HashID = top.HashIDEntry.get()
192+
WindowX = root.winfo_x()
193+
WindowY = root.winfo_y()
261194
top = Toplevel1 (root)
262195

263196
def AddPoint():
@@ -273,12 +206,19 @@ def RemovePoint():
273206
global Y
274207
global Z
275208
global CurrentPoint
209+
global WindowX
210+
global WindowY
211+
# This isn't needed for some reason.
212+
global root
213+
276214
if len(X) > 2:
277215
if CurrentPoint >= len(X)-1:
278216
CurrentPoint = len(X)-2
279217
X.pop()
280218
Y.pop()
281219
Z.pop()
220+
WindowX = root.winfo_x()
221+
WindowY = root.winfo_y()
282222
top = Toplevel1 (root)
283223

284224

@@ -291,6 +231,8 @@ def __init__(self, top=None):
291231
global Y
292232
global Z
293233
global HashID
234+
global WindowX
235+
global WindowY
294236

295237
_bgcolor = '#d9d9d9' # X11 color: 'gray85'
296238
_fgcolor = '#000000' # X11 color: 'black'
@@ -306,7 +248,7 @@ def __init__(self, top=None):
306248
self.style.map('.',background=
307249
[('selected', _compcolor), ('active',_ana2color)])
308250

309-
top.geometry("600x450+587+152")
251+
top.geometry("600x450+"+str(WindowX)+"+"+str(WindowY))
310252
top.minsize(120, 1)
311253
top.maxsize(1684, 1031)
312254
top.resizable(1, 1)

0 commit comments

Comments
 (0)