Skip to content

Instantly share code, notes, and snippets.

@andrisgauracs
Created January 10, 2019 22:51
Show Gist options
  • Select an option

  • Save andrisgauracs/ad38248f6e3f68849b915c6db39b90d1 to your computer and use it in GitHub Desktop.

Select an option

Save andrisgauracs/ad38248f6e3f68849b915c6db39b90d1 to your computer and use it in GitHub Desktop.
def valuechange(self):
# We access our global variables within the function
global framesTaken
global framesSpecified
# We set the framesSpecified value to
# whatever is specified on the spinbox
framesSpecified = self.sp.value()
# We modify our label to give us info, how many
# frames have been captured so far
self.l2.setText(
"Frames taken: "+str(framesTaken)+" from "+str(framesSpecified))
# Once the snapshot taking process has begun,
# we need to disable the spinbox
self.sp.setEnabled(0) if (framesTaken > 0) else self.sp.setEnabled(1)
# We enable our snapshot trigger button, if frames have been specified
# and the process is ongoing.
# If the process ends, we disable the button again
if (self.sp.value() > 0
and framesTaken < 10
and framesTaken < framesSpecified):
self.snapbutton.setEnabled(1)
else:
self.snapbutton.setEnabled(0)
if (self.sp.value() > 0):
self.l2.setVisible(1)
else:
self.l2.setVisible(0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment