Openai/696bd5cb-0b40-8009-a7e4-526bb5959a3d
This conversation was exported from ChatGPT[1]
gpt-5-2[edit | edit source]
User: can you help me find a python script in github that create qr code that authenticate in a wifi , for exemple i have my …[edit | edit source]
can you help me find a python script in github that create qr code that authenticate in a wifi , for exemple i have my iphone , and it scan , and it connect to the wifi
Assistant: Yes — here are some GitHub Python projects that generate Wi-Fi QR codes you can use to scan with your iPhone or any pho…[edit | edit source]
Yes — here are some GitHub Python projects that generate Wi-Fi QR codes you can use to scan with your iPhone (or any phone) to automatically connect to Wi-Fi. These generate standard Wi-Fi QR codes: when scanned by a phone’s camera, it understands the network SSID/password and can join automatically. GitHub[2]
####[edit | edit source]
📦 [GitHub: lakhanmankani/wifi_qrcode_generator](GitHub: lakhanmankani/wifi_qrcode_generator) A straightforward Python script that generates a Wi-Fi QR code using qrcode and Pillow. You can run it in Python or install as a package. GitHub[3]
Features
- Generates a QR image for an SSID + password.
- Works with standard Wi-Fi formats (WPA, WEP, None).
- Easy to use in your own script.
Basic usage example (from readme):
import wifi_qrcode_generator.generator
qr_code = wifi_qrcode_generator.generator.wifi_qrcode(
ssid='MyNetwork',
hidden=False,
authentication_type='WPA',
password='MyPassword123'
)
qr_code.make_image().save('wifi.png')
→ Scanning wifi.png with your iPhone camera connects to Wi-Fi. GitHub[4]
📦 [GitHub: vinodvidhole/wifi-qr-code (Notebook)](GitHub: vinodvidhole/wifi-qr-code (Notebook))[edit | edit source]
A Python notebook that explains and demonstrates generating Wi-Fi QR codes. It’s more of an example/project you can adapt. GitHub[5]
📦 [GitHub: ustayready/qrwifi](GitHub: ustayready/qrwifi)[edit | edit source]
Another lightweight script that generates a QR PNG from SSID and password, using standard libraries. GitHub[6]
If you want a minimal example without a full repo, you can use a gist that just does Wi-Fi QR codes:[edit | edit source]
import pyqrcode
import sys
ssid = "YourNetwork"
pwd = "YourPassword"
protocol = "WPA" # valid: WPA, WEP, nopass
data = f"WIFI:S:{ssid};T:{protocol};P:{pwd};;"
qr = pyqrcode.create(data)
qr.png(f"{ssid}_wifi.png", scale=5)
This creates a PNG file that phones understand as a Wi-Fi network. Gist[7]
When you encode a QR with the format WIFI:S:SSID;T:WPA;P:PASSWORD;;, iOS and Android cameras will recognize it and offer to join the Wi-Fi network automatically. Gist[8][edit | edit source]
- These scripts don’t configure your router or network — they just encode your credentials into a standard QR format.[edit | edit source]
- You need to provide correct SSID and password in the script.
- When your iPhone scans the generated QR (from screen or print), it will prompt to join the network.
If you want, I can also show you how to build a web interface or command-line tool around these scripts to generate QR codes easily!
gpt-5-2-thinking[edit | edit source]
User: can you create a python script that do exactly like this but it use tkinter with a nice userfriendly interface[edit | edit source]
can you create a python script that do exactly like this but it use tkinter with a nice userfriendly interface
Assistant: Absolutely — here’s a single-file Python script that gives you a nice Tkinter GUI to generate a Wi-Fi QR code scan with…[edit | edit source]
Absolutely — here’s a single-file Python script that gives you a nice Tkinter GUI to generate a Wi-Fi QR code (scan with iPhone camera → it prompts to join the network).
Install dependencies[edit | edit source]
pip install qrcode[pil] pillow
wifi_qr_gui.py[edit | edit source]
import tkinter as tk
from tkinter import ttk, filedialog, messagebox
import qrcode
from PIL import Image, ImageTk
def escape_wifi_text(s: str) -> str:
"""
Escape special chars per common WiFi QR conventions.
Many scanners expect \ for: \ ; , : "
"""
if s is None:
return ""
return (
s.replace("\\", "\\\\")
.replace(";", r"\;")
.replace(",", r"\,")
.replace(":", r"\:")
.replace('"', r"\"")
)
def build_wifi_payload(ssid: str, auth: str, password: str, hidden: bool) -> str:
# auth: "WPA", "WEP", "nopass"
ssid_e = escape_wifi_text(ssid.strip())
pwd_e = escape_wifi_text(password)
# Standard format:
# WIFI:S:<ssid>;T:<auth>;P:<password>;H:<hidden>;;
# H is optional; include for clarity
if auth == "nopass":
payload = f"WIFI:S:{ssid_e};T:nopass;P:;H:{'true' if hidden else 'false'};;"
else:
payload = f"WIFI:S:{ssid_e};T:{auth};P:{pwd_e};H:{'true' if hidden else 'false'};;"
return payload
class WifiQRApp(tk.Tk):
def __init__(self):
super().__init__()
self.title("Wi-Fi QR Code Generator")
self.geometry("780x520")
self.minsize(740, 480)
# App state
self.qr_pil = None
self.qr_tk = None
self._build_ui()
def _build_ui(self):
# Style
style = ttk.Style(self)
try:
self.tk.call("tk", "scaling", 1.0)
except Exception:
pass
container = ttk.Frame(self, padding=16)
container.pack(fill="both", expand=True)
# Layout: left form, right preview
container.columnconfigure(0, weight=1)
container.columnconfigure(1, weight=2)
container.rowconfigure(0, weight=1)
left = ttk.Frame(container)
right = ttk.Frame(container)
left.grid(row=0, column=0, sticky="nsew", padx=(0, 12))
right.grid(row=0, column=1, sticky="nsew")
# ---- Left: Form ----
title = ttk.Label(left, text="Create a Wi-Fi QR code", font=("Segoe UI", 16, "bold"))
title.pack(anchor="w", pady=(0, 12))
form = ttk.Frame(left)
form.pack(fill="x", pady=(0, 10))
# SSID
ttk.Label(form, text="Network name (SSID)").grid(row=0, column=0, sticky="w")
self.ssid_var = tk.StringVar()
self.ssid_entry = ttk.Entry(form, textvariable=self.ssid_var)
self.ssid_entry.grid(row=1, column=0, sticky="ew", pady=(4, 10))
# Auth
ttk.Label(form, text="Security").grid(row=2, column=0, sticky="w")
self.auth_var = tk.StringVar(value="WPA")
self.auth_combo = ttk.Combobox(
form,
textvariable=self.auth_var,
values=["WPA", "WEP", "nopass"],
state="readonly"
)
self.auth_combo.grid(row=3, column=0, sticky="ew", pady=(4, 10))
self.auth_combo.bind("<<ComboboxSelected>>", lambda e: self._sync_password_state())
# Password
ttk.Label(form, text="Password").grid(row=4, column=0, sticky="w")
self.pwd_var = tk.StringVar()
self.pwd_entry = ttk.Entry(form, textvariable=self.pwd_var, show="•")
self.pwd_entry.grid(row=5, column=0, sticky="ew", pady=(4, 6))
# Show password
self.show_pwd_var = tk.BooleanVar(value=False)
show_pwd = ttk.Checkbutton(
form,
text="Show password",
variable=self.show_pwd_var,
command=self._toggle_password_visibility
)
show_pwd.grid(row=6, column=0, sticky="w", pady=(0, 10))
# Hidden network
self.hidden_var = tk.BooleanVar(value=False)
hidden_cb = ttk.Checkbutton(form, text="Hidden network (SSID not broadcast)", variable=self.hidden_var)
hidden_cb.grid(row=7, column=0, sticky="w", pady=(0, 12))
form.columnconfigure(0, weight=1)
# Buttons
btns = ttk.Frame(left)
btns.pack(fill="x", pady=(4, 0))
gen_btn = ttk.Button(btns, text="Generate QR", command=self.generate_qr)
gen_btn.pack(side="left", fill="x", expand=True)
save_btn = ttk.Button(btns, text="Save PNG…", command=self.save_png)
save_btn.pack(side="left", fill="x", expand=True, padx=(10, 0))
# Tip
tip = ttk.Label(
left,
text="Tip: On iPhone, open the Camera and scan the QR.\nIt should prompt: “Join <SSID>”.",
foreground="#555"
)
tip.pack(anchor="w", pady=(14, 0))
# ---- Right: Preview ----
preview_card = ttk.Frame(right, padding=12)
preview_card.pack(fill="both", expand=True)
ttk.Label(preview_card, text="Preview", font=("Segoe UI", 12, "bold")).pack(anchor="w", pady=(0, 8))
self.preview_area = tk.Canvas(preview_card, bg="white", highlightthickness=1, highlightbackground="#ddd")
self.preview_area.pack(fill="both", expand=True)
self.payload_text = tk.Text(preview_card, height=3, wrap="word")
self.payload_text.pack(fill="x", pady=(10, 0))
self.payload_text.configure(state="disabled")
self._sync_password_state()
self.ssid_entry.focus_set()
# Regenerate on Enter
self.bind("<Return>", lambda e: self.generate_qr())
# Handle resizing of preview nicely
self.preview_area.bind("<Configure>", lambda e: self._redraw_preview())
def _toggle_password_visibility(self):
self.pwd_entry.configure(show="" if self.show_pwd_var.get() else "•")
def _sync_password_state(self):
auth = self.auth_var.get()
if auth == "nopass":
self.pwd_entry.configure(state="disabled")
self.pwd_var.set("")
else:
self.pwd_entry.configure(state="normal")
def _set_payload_display(self, payload: str):
self.payload_text.configure(state="normal")
self.payload_text.delete("1.0", "end")
self.payload_text.insert("1.0", payload)
self.payload_text.configure(state="disabled")
def generate_qr(self):
ssid = self.ssid_var.get().strip()
auth = self.auth_var.get().strip()
password = self.pwd_var.get()
if not ssid:
messagebox.showerror("Missing SSID", "Please enter a network name (SSID).")
return
if auth in ("WPA", "WEP") and not password:
messagebox.showerror("Missing password", f"Security is set to {auth}. Please enter the Wi-Fi password.")
return
payload = build_wifi_payload(ssid, auth, password, self.hidden_var.get())
self._set_payload_display(payload)
# Build QR
qr = qrcode.QRCode(
version=None,
error_correction=qrcode.constants.ERROR_CORRECT_M,
box_size=10,
border=4
)
qr.add_data(payload)
qr.make(fit=True)
img = qr.make_image(fill_color="black", back_color="white").convert("RGB")
self.qr_pil = img
self._redraw_preview()
def _redraw_preview(self):
self.preview_area.delete("all")
if self.qr_pil is None:
self.preview_area.create_text(
10, 10, anchor="nw",
text="Generate a QR code to preview it here.",
fill="#666",
font=("Segoe UI", 11)
)
return
# Fit the QR into the canvas with padding
cw = max(self.preview_area.winfo_width(), 1)
ch = max(self.preview_area.winfo_height(), 1)
pad = 20
max_w = max(cw - 2 * pad, 50)
max_h = max(ch - 2 * pad, 50)
img = self.qr_pil.copy()
img.thumbnail((max_w, max_h), Image.Resampling.LANCZOS)
self.qr_tk = ImageTk.PhotoImage(img)
x = cw // 2
y = ch // 2
self.preview_area.create_image(x, y, image=self.qr_tk, anchor="center")
def save_png(self):
if self.qr_pil is None:
messagebox.showinfo("Nothing to save", "Generate a QR code first.")
return
ssid = self.ssid_var.get().strip() or "wifi_qr"
default_name = f"{ssid}_wifi_qr.png".replace(" ", "_")
path = filedialog.asksaveasfilename(
defaultextension=".png",
filetypes=[("PNG Image", "*.png")],
initialfile=default_name,
title="Save QR code as PNG"
)
if not path:
return
try:
self.qr_pil.save(path, format="PNG")
messagebox.showinfo("Saved", f"Saved QR code to:\n{path}")
except Exception as e:
messagebox.showerror("Save failed", f"Could not save the file:\n{e}")
if __name__ == "__main__":
app = WifiQRApp()
app.mainloop()
How to use[edit | edit source]
- Run: python wifi_qr_gui.py
- Enter SSID, choose WPA/WEP/nopass, enter password if needed
- Click Generate QR
- Point your iPhone camera at the QR → it should offer to join the Wi-Fi
If you want, I can also add: dark mode, copy QR to clipboard, auto-detect SSID on your computer, or a “print” layout.
References[edit | edit source]
- ↑ "Wi-Fi QR Code Script". ChatGPT. Retrieved 2026-01-18.
- ↑ "GitHub". github.com. Retrieved 2026-01-18.
- ↑ "GitHub". github.com. Retrieved 2026-01-18.
- ↑ "GitHub". github.com. Retrieved 2026-01-18.
- ↑ "GitHub". github.com. Retrieved 2026-01-18.
- ↑ "GitHub". github.com. Retrieved 2026-01-18.
- ↑ "Gist". gist.github.com. Retrieved 2026-01-18.
- ↑ "Gist". gist.github.com. Retrieved 2026-01-18.