user interface - Python tkinter button lagging/printing upon exit -


first of note doing these in enthought/canopy.

i have basic gui has 4 entry boxes in type stuff, , hit button , prints stuff entered. however, not operating way want to. when start code , type in values , press button, won't anything, close gui window , print values entered.

also, when entered values , hit button once, again won't anything, if hit button again print values not expected. entered 1, 2, 3, 4 , hit button twice, thing see on screen 1, 2, 3, 4, 1 , when close window now, print out rest.

i'd appreciate if people can me out this. thank in advance. below code:

update: issue not happen idle, canopy.

from tkinter import *  class application:     def printcmd(self):         print(self.entrybox.get())      def __init__(self, master):         self.entrybox = entry(master)         self.button = button(master, text="print", command = self.printcmd)         self.entrybox.grid()         self.button.grid()  root = tk() application(root) root.mainloop() 

if doing in canopy gui, should ensure qt not set gui backend. see https://support.enthought.com/hc/en-us/articles/204469880-using-tkinter-turtle-or-pyglet-in-canopy-s-ipython-panel

for print lag: python buffers output. if want ensure output printed immediately, follow print statement sys.stdout.flush() flush print output buffers. (of course must first import sys.)

this can issue in python program. arises more in canopy in idle because canopy used ipython's qtconsole separates execution kernel front end terminal-like panel 2 separate os processes.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -