Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7714699
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T02:11:48+00:00 2026-06-01T02:11:48+00:00

I’m writing a basic war-driving program. I have gotten it to loop the command

  • 0

I’m writing a basic war-driving program. I have gotten it to loop the command to pull all the wireless access points near by. The problem is my stop button doesn’t work and I am unable to update the label(I’m not even sure if I can update the label).

import sys, os, subprocess, re
from Tkinter import *

missionGO = 0
count = 0

class App:

def __init__(self, master):

    frame = Frame(master)
    frame.pack()

    self.start = Button(frame, text="Start", fg="green",
                        command=self.startButtonClick)
    self.start.grid(row=3)

    self.stop = Button(frame, text="Stop", fg="red",
                       command=self.stopButtonClick)
    self.stop.grid(row=3, column=1)

    self.totalSSIDLabel = Label(frame, text="Current Access Points: ")
    self.totalSSIDLabel.grid(row=0)

    self.totalSSID = Label(frame, text=count)
    self.totalSSID.grid(row=0, column=1)

def startButtonClick(self):
    missionGO = 1
    while (missionGO == 1):
        wlan = getAccessPoints()
        x = numberOfAccessPoints(wlan)
        print x
    return

def stopButtonClick(self):
    missionGO = 0
    return

def stop(event):
    missionGO = 0

# Finds all wireless AP
def getAccessPoints():
    X = subprocess.check_output("netsh wlan show network mode=Bssid",
                                shell=True)
    return X

def numberOfAccessPoints(file):
    count = 0
    words = file.split()

for line in words:
    if re.match('SSID', line):
        count = count + 1
    return count

#Main
root = Tk()
app = App(root)
root.mainloop()
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T02:11:50+00:00Added an answer on June 1, 2026 at 2:11 am

    Tkinter is single threaded. That means that while you are in the while loop inside startButtonClick, no other events are processed. The stop button won’t call its command until the startButtonClick function finishes

    You need to remember that your program is already running a global infinite loop: the event loop. There’s no reason to put another infinite loop inside it. When you want something to run forever, the trick is to put one iteration on the event loop, then when it runs it puts another iteration on the event loop.

    The other key to this is to make sure that one iteration of the loop is fast — it needs to be well under a second (more like under 100ms) or the UI will become laggy.

    The logic looks something like this:

    def startButtonClick(self):
        self.missionGO = 1
        self._do_one_iteration()
    
    def _do_one_iteration(self):
        if self.missionGO == 1:
            wlan = getAccessPoints()
            x = numberOfAccessPoints(wlan)
            print x
            # this adds another iteration to the event loop
            self.after(10, self._do_one_iteration)
    
    def stopButtonClick(self):
        self.missionGO = 0
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a text area in my form which accepts all possible characters from
I am trying to loop through a bunch of documents I have to put
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.