Setting a new path for another script with askopenfilename() functionExtract file name from path, no matter what the os/path formatWhat could cause an open file dialog window in Tkinter/Python to be really slow to close after the user selects a file?tkinter variable for drop down selection emptyNeed Python/tkinter GUI to dynamically update itself (for a multi-lingual GUI)Replacing path name in output file in pythonPython: Writing variables to a file in a specific wayTkInter Frame doesn't load if another function is calledaskopenfilename is not defined? - Making a browse button in tkinterReceiving error (NoneType 'to_csv') while attempting to implement script into a GUIPass selection Listbox topwindow to main window

Was the old ablative pronoun "med" or "mēd"?

Solving an equation with constraints

Getting extremely large arrows with tikzcd

Can a virus destroy the BIOS of a modern computer?

Why is it a bad idea to hire a hitman to eliminate most corrupt politicians?

Are British MPs missing the point, with these 'Indicative Votes'?

Rotate ASCII Art by 45 Degrees

Should I tell management that I intend to leave due to bad software development practices?

Why do I get negative height?

Is there a hemisphere-neutral way of specifying a season?

Mathematica command that allows it to read my intentions

How does a dynamic QR code work?

Where would I need my direct neural interface to be implanted?

How to coordinate airplane tickets?

Is this draw by repetition?

How do conventional missiles fly?

ssTTsSTtRrriinInnnnNNNIiinngg

What does the same-ish mean?

Implication of namely

How to install cross-compiler on Ubuntu 18.04?

How can I deal with my CEO asking me to hire someone with a higher salary than me, a co-founder?

Machine learning testing data

How can a day be of 24 hours?

What is an equivalently powerful replacement spell for the Yuan-Ti's Suggestion spell?



Setting a new path for another script with askopenfilename() function


Extract file name from path, no matter what the os/path formatWhat could cause an open file dialog window in Tkinter/Python to be really slow to close after the user selects a file?tkinter variable for drop down selection emptyNeed Python/tkinter GUI to dynamically update itself (for a multi-lingual GUI)Replacing path name in output file in pythonPython: Writing variables to a file in a specific wayTkInter Frame doesn't load if another function is calledaskopenfilename is not defined? - Making a browse button in tkinterReceiving error (NoneType 'to_csv') while attempting to implement script into a GUIPass selection Listbox topwindow to main window













0















I am currently working with gui for my assignment by using tkinter. I would like to set a new path for my variable in objectdetector.py, whenever I run my gui script. But I got an error where the tkinter window keep popping up instead of doing what I want. Here is my code:



try2.py



from tkinter import Tk,messagebox
from tkinter.filedialog import askopenfilename
from tkinter import *
import os

window=Tk()
window.title("Wildlife Monitoring System")
window.geometry('400x400')


var = IntVar()
var.set(0)

R1 = Radiobutton(window, text="Webcam", variable=var, value=1)
R1.place(relx=.25, rely=.55, anchor="c")

R2 = Radiobutton(window, text="Input Video", variable=var, value=2)
R2.place(relx=.75, rely=.55, anchor="c")

def open():
selection=var.get()
if selection == 2:
file=askopenfilename(title="Select an input video")
window.destroy()
os.system('objectdetector.py')
elif selection == 0:
messagebox.showinfo("Error", "Please select an option.")
elif selection == 1:
window.destroy()
os.system('try.py')
return

btn = Button(window, text="Start",command=lambda: open(), height= 2, width=10)

btn.place(relx=.5, rely=.35, anchor="c")

window.mainloop()

object.detector.py


For objectdetector.py (just an example)



from try2 import file

path = 'file'

print(path)









share|improve this question
























  • from try2 import file will not do anything because there is no function or class named file. If you are trying to import everything (frowned upon) you can do from try2 import *

    – Reedinationer
    Mar 7 at 21:20















0















I am currently working with gui for my assignment by using tkinter. I would like to set a new path for my variable in objectdetector.py, whenever I run my gui script. But I got an error where the tkinter window keep popping up instead of doing what I want. Here is my code:



try2.py



from tkinter import Tk,messagebox
from tkinter.filedialog import askopenfilename
from tkinter import *
import os

window=Tk()
window.title("Wildlife Monitoring System")
window.geometry('400x400')


var = IntVar()
var.set(0)

R1 = Radiobutton(window, text="Webcam", variable=var, value=1)
R1.place(relx=.25, rely=.55, anchor="c")

R2 = Radiobutton(window, text="Input Video", variable=var, value=2)
R2.place(relx=.75, rely=.55, anchor="c")

def open():
selection=var.get()
if selection == 2:
file=askopenfilename(title="Select an input video")
window.destroy()
os.system('objectdetector.py')
elif selection == 0:
messagebox.showinfo("Error", "Please select an option.")
elif selection == 1:
window.destroy()
os.system('try.py')
return

btn = Button(window, text="Start",command=lambda: open(), height= 2, width=10)

btn.place(relx=.5, rely=.35, anchor="c")

window.mainloop()

object.detector.py


For objectdetector.py (just an example)



from try2 import file

path = 'file'

print(path)









share|improve this question
























  • from try2 import file will not do anything because there is no function or class named file. If you are trying to import everything (frowned upon) you can do from try2 import *

    – Reedinationer
    Mar 7 at 21:20













0












0








0








I am currently working with gui for my assignment by using tkinter. I would like to set a new path for my variable in objectdetector.py, whenever I run my gui script. But I got an error where the tkinter window keep popping up instead of doing what I want. Here is my code:



try2.py



from tkinter import Tk,messagebox
from tkinter.filedialog import askopenfilename
from tkinter import *
import os

window=Tk()
window.title("Wildlife Monitoring System")
window.geometry('400x400')


var = IntVar()
var.set(0)

R1 = Radiobutton(window, text="Webcam", variable=var, value=1)
R1.place(relx=.25, rely=.55, anchor="c")

R2 = Radiobutton(window, text="Input Video", variable=var, value=2)
R2.place(relx=.75, rely=.55, anchor="c")

def open():
selection=var.get()
if selection == 2:
file=askopenfilename(title="Select an input video")
window.destroy()
os.system('objectdetector.py')
elif selection == 0:
messagebox.showinfo("Error", "Please select an option.")
elif selection == 1:
window.destroy()
os.system('try.py')
return

btn = Button(window, text="Start",command=lambda: open(), height= 2, width=10)

btn.place(relx=.5, rely=.35, anchor="c")

window.mainloop()

object.detector.py


For objectdetector.py (just an example)



from try2 import file

path = 'file'

print(path)









share|improve this question
















I am currently working with gui for my assignment by using tkinter. I would like to set a new path for my variable in objectdetector.py, whenever I run my gui script. But I got an error where the tkinter window keep popping up instead of doing what I want. Here is my code:



try2.py



from tkinter import Tk,messagebox
from tkinter.filedialog import askopenfilename
from tkinter import *
import os

window=Tk()
window.title("Wildlife Monitoring System")
window.geometry('400x400')


var = IntVar()
var.set(0)

R1 = Radiobutton(window, text="Webcam", variable=var, value=1)
R1.place(relx=.25, rely=.55, anchor="c")

R2 = Radiobutton(window, text="Input Video", variable=var, value=2)
R2.place(relx=.75, rely=.55, anchor="c")

def open():
selection=var.get()
if selection == 2:
file=askopenfilename(title="Select an input video")
window.destroy()
os.system('objectdetector.py')
elif selection == 0:
messagebox.showinfo("Error", "Please select an option.")
elif selection == 1:
window.destroy()
os.system('try.py')
return

btn = Button(window, text="Start",command=lambda: open(), height= 2, width=10)

btn.place(relx=.5, rely=.35, anchor="c")

window.mainloop()

object.detector.py


For objectdetector.py (just an example)



from try2 import file

path = 'file'

print(path)






python tkinter






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 7 at 21:23









JamCon

2,04611832




2,04611832










asked Mar 7 at 21:16









shijishiji

1




1












  • from try2 import file will not do anything because there is no function or class named file. If you are trying to import everything (frowned upon) you can do from try2 import *

    – Reedinationer
    Mar 7 at 21:20

















  • from try2 import file will not do anything because there is no function or class named file. If you are trying to import everything (frowned upon) you can do from try2 import *

    – Reedinationer
    Mar 7 at 21:20
















from try2 import file will not do anything because there is no function or class named file. If you are trying to import everything (frowned upon) you can do from try2 import *

– Reedinationer
Mar 7 at 21:20





from try2 import file will not do anything because there is no function or class named file. If you are trying to import everything (frowned upon) you can do from try2 import *

– Reedinationer
Mar 7 at 21:20












0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55052919%2fsetting-a-new-path-for-another-script-with-askopenfilename-function%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55052919%2fsetting-a-new-path-for-another-script-with-askopenfilename-function%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

1928 у кіно

Захаров Федір Захарович

Ель Греко