Note that there are some explanatory texts on larger screens.

plurals
  1. POSimple app creating Python tkinter
    primarykey
    data
    text
    <p>I was trying to create a simple app for illustration purposes. The idea is as follows: Create an application which will run script files associated only to the selected courses (radio buttons). So, I create radio buttons which list out subjects (to click on). Once the subjects are selected the user has to hit the <code>Enter</code> button. This should run all the <code>.py</code> files for the selected subjects (<code>execute_script</code> function). </p> <p>However, when I run my code, I get 4 messageboxes with 'None' written inside. After clicking ok on them, I get a square windows with only the <code>enter</code> button. What can I do to correct this problem?</p> <pre><code>def check(file_name, relStatus): radioValue = relStatus.get() tkMessageBox.showinfo('You checked', radioValue) been_clicked.append(file_name) return def execute_script(): for name in been_cliked: subprocess.Popen(['python', 'C:\Users\Max\Subjects\{}'.format(name)]) yield def main(): #Create application app = Tk() app.title('Coursework') app.geometry('450x300+200+200') #Header labelText = StringVar() labelText.set('Select subjects') #Dictionary with names product_names = {} names = [] file_name = [] names = ['Math', 'Science', 'English', 'French'] file_name = ['calc.py', 'physics.py', 'grammar.py', 'livre.py'] product_names = OrderedDict(zip(names, file_name)) #Create radio buttons global been_clicked been_clicked = [] relStatus = StringVar() relStatus.set(None) for name,file_name in product_names.iteritems(): radio1 = Radiobutton(app, text=name, value=name, \ variable=relStatus, command=check(file_name, relStatus)) button = Button(app, text='Click Here', width=20, command=execute_script()) button.pack(side='bottom', padx=15, pady=15) app.mainloop() if __name__ == '__main__': main() </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload