Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Nov 2016
    Location
    South Africa, Cape Town
    Posts
    49
    Thanks
    1
    Thanked 1 Time in 1 Post

    Adhoc Creator BETA - Python fun

    Here's something I've been messing around with for fun. I think it'll be cool to see what people can do with it and how they change it.
    Lol and yes I know this code is pretty messy at certain places and please don't hold me to this -- This is something I simply made out of boredom.

    Not tested on multiple platforms. Only Windows ( The OS I was using at the time ).
    Not tested on machines without a network connection ( WiFI or LAN ).

    Code:
    from Tkinter import *
    import ttk, ctypes, os, subprocess, threading
    
    class adhoc_starter:
        def __init__(self, master):
            
            self.master = master
            self.styler = ttk.Style()
    
            self.right_side = ttk.Frame(master)
            self.right_side.pack(side=RIGHT, anchor=NE, expand=True, fill=X)
    
            self.top_frame = ttk.Frame(self.right_side)
            self.top_frame.pack(side=TOP, anchor=NW, fill=BOTH, expand=True)
    
            self.bot_frame = ttk.Frame(self.right_side)
            self.bot_frame.pack(side=BOTTOM, anchor=NW, fill=BOTH, expand=True)
    
    
            self.mode_label = ttk.Label(self.top_frame, text="Mode: ")
            self.mode_label.pack(side=LEFT, anchor=NW, pady=15, padx=10
    )
    
            self.top_frame_inner = ttk.Frame(self.top_frame)
            self.top_frame_inner.pack(side=LEFT, anchor=NW, padx=1
    3)
    
            self.allow_checker = StringVa
    r()
    
            def set_mode():
                # THIS MODE CHECKER CALLED allow_checker IS THE SAME AS usage_checker
                # IT'S USED FURTHER DOWN THE CODE TO PARSE ARGUMENTS TO THE TERMINAL
                # WHERE THE ARGUMENT WOULD BE mode=allow/disallow FOR hostednetwork
                var = self.allow_checker.get()
                if var == "allow":
        
                self.allow_checker.set("allow")
                    self.statusbar.config(text="Mode Set To Allowed")
                else:
                    self.allow_checker.set("disallow")
                    self.statu
    sbar.config(text="Mode Set To Disallowed")
    
            self.allowed_but = ttk.Radiobutton(self.top_frame_inner, text="Allow", variable=self.allow_checker, value="allow", command=set_mode)
            self.allowed_but.pack(si
    de=TOP, anchor=NW, expand=True)
    
            self.disallowed_but = ttk.Radiobutton(self.top_frame_inner, text="Disallow", variable=s
    elf.allow_checker, value="disallow", command=set_mode)
            self.disallowed_but.pack(side=TOP, anchor=NW, expand=True)
    
    
            self.namer_label = ttk.Label(self.top_frame, text="SSID:")
            self.namer_label.pack(side=LEFT, anchor=NW, pady=10)
    
            self.namer = ttk.Entry(self.top_frame)
            self.namer.pack(side=LEFT, anchor=NW, pady=10, expand=True, fill=X)
    
            self.bot_frame_top = ttk.Frame(self.bot_frame)
            self.bot_frame_top.pack(side=TOP, expand=True, fill=BOTH, anchor=NW)
    
            self.key_usage_label = ttk.Label(self.bot_frame_top, text="Key-Use: ")
            self.key_usage_label.pack(side=LEFT, anchor=NW, padx=10, pady=10)
    
            self.bot_frame_inner = ttk.Frame(self.bot_frame_top)
            self.bot_frame_inner.pack(side=LEFT, anchor=NW)
    
            self.usage_checker = StringVar()
    
            def set_usage():
                var = self.usage_checker.get()
                if var == "persistent":
                    self.usage_checker.set("persistent")
                    self.statusbar.config(text="Key-Usage Set To Persistent")
                else:
                    self.usage_checker.set("temporary")
                    self.statusbar.config(text="Key-Usage Set To Temporary")
    
            self.pers_but = ttk.Radiobutton(self.bot_frame_inner, text="Persistent", variable=self.usage_checker, value="persistent", command=set_usage)
            self.pers_but.pack(side=TOP, anchor=NW, expand=True)
    
            self.temp_but = ttk.Radiobutton(self.bot_frame_inner, text="Temporary", variable=self.usage_checker, value="temporary", command=set_usage)
            self.temp_but.pack(side=TOP, anchor=NW, expand=True)
    
            self.key_label = ttk.Label(self.bot_frame_top, text="Key: ")
            self.key_label.pack(side=LEFT, anchor=NW, pady=10)
    
            self.key = ttk.Entry(self.bot_frame_top)
            self.key.pack(side=LEFT, anchor=NW, pady=10, expand=True, fill=X)
    
            self.bot_frame_bot = ttk.Frame(self.bot_frame)
            self.bot_frame_bot.pack(side=TOP, expand=True, fill=BOTH, anchor=SW)
    
            self.statusbar = Label(self.bot_frame_bot, text="", relief=SUNKEN, bg="#000000", fg="#ffffff")
            self.statusbar.pack(side=BOTTOM, fill=BOTH, expand=True, anchor=S)
    
            self.left_side = ttk.Frame(master)
            self.left_side.pack(side=LEFT, anchor=NW, fill=BOTH)
    
            self.left_side_left = ttk.Frame(master)
            self.left_side_left.pack(side=LEFT, anchor=NW, fill=BOTH)
    
            self.left_side_right = ttk.Frame(master)
            self.left_side_right.pack(side=LEFT, anchor=NW, fill=BOTH)
    
            def create_hostednetwork():
                # CONDITIONAL - IF THE NAME IS NOT BLANK
                if not str(self.namer.get()).isspace() and not str(self.namer.get()) == "":
                    # IF THE LENGTH OF THE KEY IS MORE THAN OR EQUAL TO 8 CHARACTERS LONG
                    if len(str(self.key.get())) >= 8:
                        # IF THE MODE AND KEY USAGE OPTIONS ARE NOT BLANK
                        if self.allow_checker.get() != "":
                            if self.usage_checker.get() != "":
                                if self.admin:
                                    self.the_call = subprocess.Popen(
                                        "netsh wlan set hostednetwork ssid=" + self.namer.get() + " mode=" + self.allow_checker.get() +
                                        " key=" + self.key.get() + " keyUsage=" + self.usage_checker.get(),
                                        stdout=subprocess.PIPE, shell=True)
                                    self.statusbar.config(text="Hosted network " + self.namer.get() + " has been created")
                                    self.import_adhoc.configure(state=NORMAL)
                                else:
                                    self.statusbar.config(text="Run this program as an Administrator")
                            else:
                                self.statusbar.config(text="Key-Usage cannot be left blank")
                        else:
                            self.statusbar.config(text="Mode cannot be left blank")
                    else:
                        self.statusbar.config(text="Key cannot be left blank or less than 8 characters")
                else:
                    self.statusbar.config(text="SSID cannot be left blank")
    
            self.start_creation = ttk.Button(self.left_side_right, text="Create", command=create_hostednetwork)
            self.start_creation.pack(side=TOP, expand=True, fill=BOTH)
    
            def start_hostednetwork():
                if self.admin:
                    self.the_call = subprocess.Popen("netsh wlan start hostednetwork", stdout=subprocess.PIPE, shell=True)
                    self.statusbar.config(text="The hosted network has been started")
                    self.import_adhoc.configure(state=NORMAL)
                    self.start_adhoc.configure(state=DISABLED)
                    self.stop_adhoc.configure(state=NORMAL)
                else:
                    self.statusbar.config(text="Run this program as an Administrator")
    
            self.start_adhoc = ttk.Button(self.left_side_right, text="Start", command=start_hostednetwork)
            self.start_adhoc.pack(side=TOP, expand=True, fill=BOTH)
    
            def stop_hostednetwork():
                if self.admin:
                    self.the_call = subprocess.Popen("netsh wlan stop hostednetwork", stdout=subprocess.PIPE, shell=True)
                    self.statusbar.config(text="The hosted network has been stopped")
                    self.import_adhoc.configure(state=NORMAL)
                    self.start_adhoc.configure(state=NORMAL)
                    self.stop_adhoc.configure(state=DISABLED)
                else:
                    self.statusbar.config(text="Run this program as an Administrator")
    
            self.stop_adhoc = ttk.Button(self.left_side_right, text="Stop", command=stop_hostednetwork)
            self.stop_adhoc.pack(side=TOP, expand=True, fill=BOTH)
    
            def import_adhoc_settings():
    
                def threaded():  # WE CREATE A THREAD SO THIS 'HOG' FUNCTION CAN RUN CONCURRENTLY WITHOUT FREEZING THE GUI
                    try:
                        if self.admin:
                            # THE FOLLOWING LIST OF STATEMENTS IS FILTERING TERMINAL OUTPUT
                            # AND THEN ASSIGNING THE FILTERED VALUES TO VARIABLES
                            # WE STREAM ALL INFORMATION USING THE stdout=subprocess.PIPE ARGUMENT
                            # WE THEN CALL TO COMMUNICATE TO RETURN THE TUPLE AND FILTER THROUGH IT BY SELECTING INDEXES
                            self.the_call = subprocess.Popen("netsh wlan show hostednetwork", stdout=subprocess.PIPE, shell=True)
                            # WE USE THE split METHOD OF STRINGS TO SEPARATE THE OUTPUT INTO INDIVIDUAL VALUES OF THE TUPLE
                            # WE THEN FILTER THIS WITH split TO GET RID OF UNDESIRED CHARACTERS
                            # THE re MODULE COULD ALSO BE SUBSTITUTED HERE FOR REGULAR EXPRESSIONS
                            self.mode = str(self.the_call.communicate()).split()[7].strip("rn\\")
                            self.allow_checker.set(self.mode.lower()[:-2])
                            self.the_call = subprocess.Popen("netsh wlan show hostednetwork", stdout=subprocess.PIPE, shell=True)
                            self.ssid = str(self.the_call.communicate()).split()[11].strip("rn\\")
                            self.namer.delete(0, END)
                            self.namer.insert(END, str(self.ssid).replace('"', ""))
                            self.the_call = subprocess.Popen("netsh wlan show hostednetwork security", stdout=subprocess.PIPE, shell=True)
                            self.key_im = str(self.the_call.communicate()).split()[21].strip("rn\\")
                            self.key.delete(0, END)
                            self.key.insert(END, self.key_im)
                            self.the_call = subprocess.Popen("netsh wlan show hostednetwork security", stdout=subprocess.PIPE, shell=True)
                            self.key_use = str(self.the_call.communicate()).split()[26].strip("rn,;'\\")
                            self.usage_checker.set(self.key_use.lower())
                            self.statusbar.config(text="Import Successful")
                        else:
                            self.statusbar.config(text="Run this program as an Administrator")
                    except IndexError:
                        pass
    
                # WE SET A VARIABLE tt TO HANDLE THE THREAD
                tt = threading.Thread(target=threaded)
                tt.setDaemon(True) # SET TO DAEMONIC SO IT DIES ON MAIN END
                # CHECK TO SEE IF THE THREAD IS STILL RUNNING
                # IF IT IS - WE KILL IT
                if tt.is_alive():
                    # IN THIS INSTANCE THE CALL TO THE BREAK STATEMENT STOPS THE THREAD LOOP AND SILENTLY EXITS
                    tt.join()
                    return "break"
                else:  # OTHERWISE
                    # WE START THE THREAD
                    tt.start()
                    self.import_adhoc.configure(state=DISABLED)
    
            def start_up_check():
                def started():
                    self.started = subprocess.Popen("netsh wlan show hostednetwork", stdout=subprocess.PIPE, shell=True)
                    self.output = str(self.started.communicate()).split()[30]
    
                    if self.output.lower() == "not":
                        self.start_adhoc.configure(state=NORMAL)
                        self.stop_adhoc.configure(state=DISABLED)
                    else:
                        self.start_adhoc.configure(state=DISABLED)
                        self.stop_adhoc.configure(state=NORMAL)
    
                tmain = threading.Thread(target=started)
                tmain.start()
    
                if tmain.is_alive():
                    tmain.join()
                    return "break"
    
            start_up_check()
    
            self.import_adhoc = ttk.Button(self.left_side_right, text="Import", command=import_adhoc_settings)
            self.import_adhoc.pack(side=TOP, expand=True, fill=BOTH)
    
            self.left_side_right2 = ttk.Frame(master)
            self.left_side_right2.pack(side=LEFT, anchor=NW, fill=BOTH)
    
            self.flags = 0
    
            def show_wifi_networks():
                if self.flags == 1:
                    try:
                        self.root.destroy()
                        self.flags = 0
                    except TclError:
                        self.statusbar.configure(text="Opened Networks Window")
                        self.flags = 1
                        import ScrolledText
                        import tkFileDialog
    
                        self.root = Tk()
    
                        self.texter = ScrolledText.ScrolledText(self.root, wrap=WORD)
                        self.texter.pack(side=TOP)
    
                        self.statusbar1 = Label(self.root, text="")
                        self.statusbar1.pack(side=TOP)
    
                        self.show_wifi = subprocess.Popen("netsh wlan show networks mode=Bssid", stdout=subprocess.PIPE, shell=True)
                        self.output = self.show_wifi.communicate()[0]
                        self.texter.insert(END, self.output)
                        self.show_wifi = subprocess.Popen("netsh lan show interfaces", stdout=subprocess.PIPE, shell=True)
                        self.output = self.show_wifi.communicate()[0]
                        self.texter.insert(END, "Interface Name: LAN" + self.output)
    
                        def getFile():
                            self.fileName = ""
                            self.thePath = ""
                            try:
                                self.thePath = tkFileDialog.askopenfilename(filetypes=[("All Files", "*.*"),
                                                                                       ("Text Files", "*.txt *.rtf *.odt *.pdf *.doc *.docx")
                                                                                       ])
    
                                for x in self.thePath[::-1]:
                                    if x == "/" or x == "\\" or x == "//" or x == "\\\\":
                                        break
                                    else:
                                        self.fileName += x
                                self.theFile = file(self.thePath)
                                self.statusbar1.configure(text="Opened " + self.fileName[::-1])
    
                                self.texter.delete(0.0, END)
                                self.fileCont = self.theFile.read()
                                self.texter.insert(END, self.fileCont)
    
                            except:
                                self.statusbar1.config(text=unicode(self.fileName).encode("utf-8") + " Failed To Load File")
    
                        def do_save(event=None):
                            self.savedFile = tkFileDialog.asksaveasfilename(title="Save As", filetypes=[("All Files", "*.*"),
                                                                                                        ("Text Files",
                                                                                                         "*.txt *.rtf *.odt *.pdf *.doc *.docx")
                                                                                                        ])
                            if self.savedFile != "":
                                try:
                                    self.wFile = open(self.savedFile, "w")
                                    self.wFile.write(unicode(self.texter.get(0.0, END)).encode("utf-8"))
                                    self.statusbar1.config(text=unicode(self.savedFile).encode("utf-8") + " Saved Successfully")
                                except:
                                    self.statusbar1.config(text=" Failed To Save File " + unicode(self.savedFile).encode("utf-8"))
    
                        self.textMenu = Menu(self.root, tearoff=0)
                        self.textMenu.add_command(label="Copy", accelerator="Ctrl+C", command=lambda: self.texter.event_generate("<Control-c>"))
                        self.textMenu.add_command(label="Cut", accelerator="Ctrl+X", command=lambda: self.texter.event_generate("<Control-x>"))
                        self.textMenu.add_separator()
                        self.textMenu.add_command(label="Paste", accelerator="Ctrl+V", command=lambda: self.texter.event_generate("<Control-v>"))
                        self.textMenu.add_separator()
    
                        def selAll():
                            self.texter.tag_add(SEL, 0.0, END)
    
                        self.textMenu.add_command(label="Select All", accelerator="Ctrl+A", command=selAll)
    
                        def popup(event=None):
                            self.texter.focus()
                            self.textMenu.post(self.texter.winfo_pointerx(), self.texter.winfo_pointery())
    
                        def stopClassBinding(event=None):
                            self.texter.tag_add(SEL, 0.0, END)
                            return "break"
    
                        self.texter.bind("<Control-a>", stopClassBinding)
                        self.texter.bind("<Button-3>", popup)
                        self.texter.bind("<Control-s>", do_save)
    Look at next post for the rest -- It's a bit long.

  2. #2
    New Coder
    Join Date
    Nov 2016
    Location
    South Africa, Cape Town
    Posts
    49
    Thanks
    1
    Thanked 1 Time in 1 Post
    Code:
                        self.menu = Menu(self.root, tearoff=0)
                        self.filemenu = Menu(self.menu, tearoff=0)
                        self.menu.add_cascade(label="File", menu=self.filemenu)
                        self.filemenu.add_command(label="Open", command=getFile)
                        self.filemenu.add_separator()
                        self.filemenu.add_command(label="Save", command=do_save)
                        self.filemenu.add_separator()
                        self.filemenu.add_command(label="Exit", command=self.root.destroy)
    
                        self.root.configure(menu=self.menu)
                        self.root.title("Networks List")
                        self.root.focus_force()
                        self.root.mainloop()
                else:
                    self.statusbar.configure(text="Opened Networks Window")
                    self.flags = 1
                    import ScrolledText
                    import tkFileDialog
    
                    self.root = Tk()
    
                    self.texter = ScrolledText.ScrolledText(self.root, wrap=WORD)
                    self.texter.pack(side=TOP)
    
                    self.statusbar1 = Label(self.root, text="")
                    self.statusbar1.pack(side=TOP)
    
                    self.show_wifi = subprocess.Popen("netsh wlan show networks mode=Bssid", stdout=subprocess.PIPE, shell=True)
                    self.output = self.show_wifi.communicate()[0]
                    self.texter.insert(END, self.output)
                    self.show_wifi = subprocess.Popen("netsh lan show interfaces", stdout=subprocess.PIPE, shell=True)
                    self.output = self.show_wifi.communicate()[0]
                    self.texter.insert(END, "Interface Name: LAN" + self.output)
    
                    def getFile():
                        self.fileName = ""
                        self.thePath = ""
                        try:
                            self.thePath = tkFileDialog.askopenfilename(filetypes=[("All Files", "*.*"),
                                                                                   ("Text Files", "*.txt *.rtf *.odt *.pdf *.doc *.docx")
                                                                                   ])
    
                            for x in self.thePath[::-1]:
                                if x == "/" or x == "\\" or x == "//" or x == "\\\\":
                                    break
                                else:
                                    self.fileName += x
                            self.theFile = file(self.thePath)
                            self.statusbar1.configure(text="Opened " + self.fileName[::-1])
    
                            self.texter.delete(0.0, END)
                            self.fileCont = self.theFile.read()
                            self.texter.insert(END, self.fileCont)
    
                        except:
                            self.statusbar1.config(text=unicode(self.fileName).encode("utf-8") + " Failed To Load File")
    
                    def do_save(event=None):
                        self.savedFile = tkFileDialog.asksaveasfilename(title="Save As", filetypes=[("All Files", "*.*"),
                                                                                                    (
                                                                                                    "Text Files", "*.txt *.rtf *.odt *.pdf *.doc *.docx")
                                                                                                    ])
                        if self.savedFile != "":
                            try:
                                self.wFile = open(self.savedFile, "w")
                                self.wFile.write(unicode(self.texter.get(0.0, END)).encode("utf-8"))
                                self.statusbar1.config(text=unicode(self.savedFile).encode("utf-8") + " Saved Successfully")
                            except:
                                self.statusbar1.config(text=" Failed To Save File " + unicode(self.savedFile).encode("utf-8"))
    
                    self.textMenu = Menu(self.root, tearoff=0)
                    self.textMenu.add_command(label="Copy", accelerator="Ctrl+C", command=lambda: self.texter.event_generate("<Control-c>"))
                    self.textMenu.add_command(label="Cut", accelerator="Ctrl+X", command=lambda: self.texter.event_generate("<Control-x>"))
                    self.textMenu.add_separator()
                    self.textMenu.add_command(label="Paste", accelerator="Ctrl+V", command=lambda: self.texter.event_generate("<Control-v>"))
                    self.textMenu.add_separator()
    
                    def selAll():
                        self.texter.tag_add(SEL, 0.0, END)
    
                    self.textMenu.add_command(label="Select All", accelerator="Ctrl+A", command=selAll)
    
                    def popup(event=None):
                        self.texter.focus()
                        self.textMenu.post(self.texter.winfo_pointerx(), self.texter.winfo_pointery())
    
                    def stopClassBinding(event=None):
                        self.texter.tag_add(SEL, 0.0, END)
                        return "break"
    
                    self.texter.bind("<Control-a>", stopClassBinding)
                    self.texter.bind("<Button-3>", popup)
                    self.texter.bind("<Control-s>", do_save)
    
                    self.menu = Menu(self.root, tearoff=0)
                    self.filemenu = Menu(self.menu, tearoff=0)
                    self.menu.add_cascade(label="File", menu=self.filemenu)
                    self.filemenu.add_command(label="Open", command=getFile)
                    self.filemenu.add_separator()
                    self.filemenu.add_command(label="Save As", command=do_save)
                    self.filemenu.add_separator()
                    self.filemenu.add_command(label="Exit", command=self.root.destroy)
    
                    self.root.configure(menu=self.menu)
                    self.root.title("Networks List")
                    self.root.focus_force()
                    self.root.mainloop()
    
            self.network_list = ttk.Button(self.left_side_right2, text="Networks", command=show_wifi_networks)
            self.network_list.pack(side=TOP, expand=True, fill=BOTH)
    
            self.styler.configure("TFrame", background="#000000", foreground="#ffffff")
            self.styler.configure("TLabel", background="#000000", foreground="#ffffff")
            self.styler.configure("TRadiobutton", background="#000000", foreground="#ffffff")
            self.styler.configure("TButton", background="#000000")
    
            def import_control(event=None):
                self.import_adhoc.configure(state=NORMAL)  # WE SET STATE TO NORMAL SO WE CAN CLICK IT AGAIN AS CHANGES HAVE BEEN MADE
    
            self.namer.bind("<Key>", import_control)  # HERE WE BIND ALL KEY CHANGES MADE TO ENTRY BOX AND RUN FUNCTION import_control
            self.key.bind("<Key>", import_control)
            self.allowed_but.bind("<Button-1>", import_control)
            self.disallowed_but.bind("<Button-1>", import_control)
            self.pers_but.bind("<Button-1>", import_control)
            self.temp_but.bind("<Button-1>", import_control)
    
            # DEFINE MENUS FOR BOTH ENTRY BOXES
    
            self.name_menu = Menu(master, tearoff=0)
            self.name_menu.add_command(label="Copy", accelerator="Ctrl+C", command=lambda: self.namer.event_generate("<Control-c>"))
            self.name_menu.add_command(label="Cut", accelerator="Ctrl+X", command=lambda: self.namer.event_generate("<Control-x>"))
            self.name_menu.add_separator()
            self.name_menu.add_command(label="Paste", accelerator="Ctrl+V", command=lambda: self.namer.event_generate("<Control-v>"))
            self.name_menu.add_separator()
    
            def sel_all_name():
                self.namer.select_range(0, END)
    
            self.name_menu.add_command(label="Select All", accelerator="Ctrl+A", command=sel_all_name)
    
            def popup_name(event=None):
                self.namer.focus()
                self.name_menu.post(self.namer.winfo_pointerx(), self.namer.winfo_pointery())
    
            def stop_class_binding_name(event=None):
                self.namer.select_range(0, END)
                return "break"  # CALL TO RETURN A BREAK STATEMENT ON MAIN SO CONTROL-a CAN BE USED
                # WE HAVE TO RETURN BREAK AFTER CONTROL-a BECAUSE THERE'S ALREADY A CLASS BINDING FOR IT
                # SO TO ONLY HAVE THE BINDING APPLY TO OUR CLASS WE CALL BREAK TO EXIT THE BINDING FOR THE __main__ CLASS
    
            self.namer.bind("<Control-a>", stop_class_binding_name)
            self.namer.bind("<Button-3>", popup_name)
    
            self.key_menu = Menu(master, tearoff=0)
            self.key_menu.add_command(label="Copy", accelerator="Ctrl+C", command=lambda: self.key.event_generate("<Control-c>"))
            self.key_menu.add_command(label="Cut", accelerator="Ctrl+X", command=lambda: self.key.event_generate("<Control-x>"))
            self.key_menu.add_separator()
            self.key_menu.add_command(label="Paste", accelerator="Ctrl+V", command=lambda: self.key.event_generate("<Control-v>"))
            self.key_menu.add_separator()
    
            def sel_all_key():
                self.key.select_range(0, END)
    
            self.key_menu.add_command(label="Select All", accelerator="Ctrl+A", command=sel_all_key)
    
            def popup_key(event=None):
                self.key.focus()
                self.key_menu.post(self.key.winfo_pointerx(), self.key.winfo_pointery())
    
            def stop_class_binding_key(event=None):
                self.key.select_range(0, END)
                return "break"
    
            self.key.bind("<Control-a>", stop_class_binding_key)
            self.key.bind("<Button-3>", popup_key)
    
            try:
                self.admin = os.getuid() == 0
                self.statusbar.configure(text="Running Limited")
            except AttributeError:
                self.admin = ctypes.windll.shell32.IsUserAnAdmin() != 0
                self.statusbar.configure(text="Running as Admin")
    
    
            # CONFIGURE MAIN WINDOW PROPERTIES
    
            master.configure(background="#000000")
            master.title("Adhoc Creator")
            master.resizable(False, False)  # THIS PREVENTS THE CURSOR FROM CHANGING ON EDGES
            master.minsize(660, 115)  # NO RESIZE AND OUR OWN VALUES TO SPECIFY WINDOW HEIGHT AND WIDTH
            master.maxsize(660, 115)
            master.mainloop()
    
    
    if __name__ == "__main__":
        App = adhoc_starter(Tk())


 

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •