资源简介
用python写的wifi热点共享软件,简单实用,练手好题材
代码片段和文件信息
# -*- coding: utf-8 -*-
#author: Cullen
#import the needed module
from Tkinter import *
import tkFont
import tkMessageBox
import os
from PIL import ImageTk Image
def close_window(window):
“““give prompt when user close the window“““
if tkMessageBox.askyesno(“QUIT“ “Close the Window(Yes/No)“ icon=“question“):
window.destroy()
def manage_wifi(how message_frame):
“““this function will open/close the wifi network accoring the arguments:
how=1(open the network) how=2(close the network)
message_frame(the frame which the message display“““
open_wifi_cmd = “netsh wlan start hostednetwork“
close_wifi_cmd = “netsh wlan stop hostednetwork“
if how == 1:
cmd = open_wifi_cmd
else:
cmd = close_wifi_cmd
result = os.system(cmd)
if result != 0:
if how == 1:
message_frame.listbox_insert(“请检查无线网卡是否打开,设置是否正确“)
else:
message_frame.listbox_insert(“关闭WIFI失败!“)
else:
if how == 1:
message_frame.listbox_insert(“WIFI已打开“)
else:
message_frame.listbox_insert(“WIFI已关闭“)
class ShowMessageframe():
“““will create a frame contanis a listbox and scrollbar“““
def __init__(self):
self.frame = frame()
self.message_ft = tkFont.Font(family=“Arial“ size=10)
self.scrollbar = Scrollbar(self.frame orient=VERTICAL)
self.listbox = Listbox(self.frame bg=“grey“ selectbackground=“blue“
selectmode=“extended“ font=self.message_ft width=20)
self.scrollbar.config(command=self.listbox.yview)
self.scrollbar.pack(side=RIGHT fill=Y)
self.listbox.config(yscrollcommand=self.scrollbar.set)
self.listbox.pack(side=LEFT fill=BOTH expand=1)
self.listbox_insert(“Welcome to WIFI!“)
def listbox_insert(self args):
self.listbox.insert(END args)
class MyMenu():
“““Create the Menu for Window“““
message_status = 1
def __init__(self root):
self.menubar = Menu(root)
self.optionmenu = Menu(self.menubar tearoff=1)
self.optionmenu.add_command(label=‘Show Message‘ command=lambda : self.show_messagebox(root))
self.optionmenu.add_command(label=‘Hide Message‘ command=lambda : self.hide_messagebox(root))
self.optionmenu.add_separator()
self.optionmenu.add_command(label=‘Exit‘ command=lambda : close_window(root))
self.menubar.add_cascade(label=‘Options‘ menu=self.optionmenu)
self.helpmenu = Menu(self.menubar tearoff=1)
self.helpmenu.add_command(label=‘About‘ command=self.show_info)
self.menubar.add_
- 上一篇:弹球小游戏Python源代码
- 下一篇:Python爬取微博评论代码
相关资源
- python实现SGBM图像匹配算法
- python实现灰度直方图均衡化
- scrapy_qunar_one
- Python学习全系列教程永久可用
- python简明教程.chm
- 抽奖大转盘python的图形化界面
- 双边滤波器实验报告及代码python
- python +MYSQL+HTML实现21蛋糕网上商城
- Python-直播答题助手自动检测出题搜索
- OpenCV入门教程+OpenCV官方教程中文版
- Python 串口工具源码+.exe文件
- Python开发的全栈股票系统.zip
- Python操作Excel表格并将其中部分数据写
- python书籍 PDF
- 利用python绘制散点图
- python+labview+No1.vi
- 老男孩python项目实战
- python源码制作whl文件.rar
- python3.5可用的scipy
- PYTHON3 经典50案例.pptx
- 计算机科学导论-python.pdf
- python模拟鼠标点击屏幕
- windows鼠标自动点击py脚本
- 鱼c小甲鱼零基础学python全套课后题和
- Python 练习题100道
- Practical Programming 2nd Edition
- wxPython Application Development Cookbook
- python 3.6
- Python 3.5.2 中文文档 互联网唯一CHM版本
- python3.5.2.chm官方文档
评论
共有 条评论