Note that there are some explanatory texts on larger screens.

plurals
  1. POTk python code is ignored?
    primarykey
    data
    text
    <p>I'm making a GUI based game but for some reason a couple of lines in my code are not doing anything at all, when i know they should be. </p> <pre><code>def inspect(): if 'camera' in inv: out1.config(text="there's nothing unusual here") darts() </code></pre> <p>For some reason, darts() and out1.config() are completely ignored in this specific part of the code.</p> <p>I know the if statement runs as it should, I have used some print statements to make sure. the function is called at the right time, and inv does contain 'camera'.</p> <p>I have used different text in out1.config(),but no matter what this line wont do anything.</p> <p>the code simply continues on after as normal, as if the if statement never ran, and just does what would happen if the statement returned false. everything past then runs fine, everything before runs fine.</p> <p>This bit of code worked perfect before, but just when i came back to do some more work on it it suddenly dosnt work. </p> <p>Here is the GUI part:</p> <pre><code>global a , b , c , d ,out1 , main_menu,out2 main_menu.destroy() window=gui.Tk() global window actions1 = gui.Frame(window) out2 = gui.Label(window,text='Brefing room ; Cmdr Forge') out1 = gui.Message(window,text='ok') line = gui.Label(text='-------------------------------------------------------------') a = gui.Button(window,text = 'a') b = gui.Button(window,text = 'b') c = gui.Button(window, text = 'c') d = gui.Button(window, text = 'd') out2.pack() line.pack() out1.pack(side='right') actions1.pack() a.pack() b.pack() c.pack() d.pack() start() window.mainloop() </code></pre> <p>EVERYTHING else that uses this works as it should.</p> <p>This is the part of code that inspect() is in:</p> <pre><code>def darts(): def inspect(): if 'camera' in inv: out1.config(text="there's nothing unusual here") darts() def inspect_glass(): def remove(): out1.config(text = 'you now have a minature video camera. If only you knew where to plug it in so you could see the footage.') inv.append('camera') darts() out1.config (text="on closer inspection it appears to be a lens of a minature video camrea. it is not one of the agency's, it looks different from the ones they use.") a.config (text='remove camrea',command = remove) out1.config(text='above the dartboord apears to be a small glass ball, pressed firmly into the wall') a.config(text='look closer',command = inspect_glass) a.config(text='look at dartboard', command = inspect) b.config(text='play darts', command = play_darts) c.config(text='do something elce', command = commons) out2.config(text='Common room ; darts') </code></pre> <p>The code basicly does this: if you look at the deartboard you see a glass ball. if you look closer you see its a camrea. you have the option to take it. ten if you were to look at the dartboard again, it should say nothing usual here, if you had already taken the camera.</p>
    singulars
    1. This table or related slice is empty.
    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.
 

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