用python來做一個APP | python GUI 基礎(實戰)
上程式碼
import tkinter as tk
class APP:
def __init__(self, master):
frame = tk.Frame(master)
frame.pack(side=tk.LEFT, padx=10, pady=10)
self.hi_there = tk.Button(frame, text="打招呼", bg="black", fg="white", command=self.say_hi)
self.hi_there.pack()
def say_hi(self) :
print("網際網路的廣大朋友們大家好,我是閆晉文!")
root = tk.Tk()
app = APP(root)
root.mainloop()
執行後彈出
點選打招呼
按鈕後控制檯輸出
網際網路的廣大朋友們大家好,我是閆晉文!
一個簡單的pythonGUI完成了
相關推薦
用python來做一個APP | python GUI 基礎(實戰)
上程式碼 import tkinter as tk class APP: def __init__(self, master): frame = tk.Frame(mas
Python + Robotframework + Appium 之APP自動化測試小試牛刀(Android)
transform all 分享 直接 round letter 執行 image col Robotframework如何好?這裏先不說了~ Python更不用說了~ Appium前面的文章有介紹~ 今天直接來Python+Robotframework+Appium
Python + Robotframework + Appium 之APP自動化測試實踐(二)
廢話不多說,直接來實踐(二),本次基於Android手機Settings模組下的search功能進行的自動化測試,程式碼如下 : 1 *** Settings *** 2 Library AppiumLibrary 3 4 *** Variables
用Jmeter做一個簡單的介面測試(一)
Jmeter介面測試例項 1.新建一個Thread Group 2. 線上程組下建一個HTTP請求 3. 在http請求下建檢視結果樹 4. 在http請求下建聚合報告 5.在http請求下建圖形結果 6.執行 最後右擊執行緒組,單擊
Maven用來做什麼?——Maven學習筆記(一)
接觸Maven是在去年11月份,確切說,對於Java程式學習開發是3個月左右,前兩年學習過一些java入門,後來工作重心轉為硬體,就沒有接觸軟體開發,直到去年辭職後,來到現在的公司,重新回到軟體開發行
用js來實現那些數據結構11(字典)
完成 str function .get 自己的 items 結構 AR pre 我們這篇文章來說說Map這種數據結構如何用js來實現,其實它和集合(Set)極為類似,只不過Map是【鍵,值】的形式存儲元素,通過鍵來查詢值,Map用於保存具有映射關系的數據,Map裏保存
Python網路資料爬取----網路爬蟲基礎(一)
The website is the API......(未來的資料都是通過網路來提供的,website本身對爬蟲來講就是自動獲取資料的API)。掌握定向網路資料爬取和網頁解析的基本能力。 ##Requests 庫的使用,此庫是Python公認的優秀的第三方網路爬蟲庫。能夠自動的爬取HTML頁面;自動的
測試大佬談 如何進入BAT大廠做一個測試開發工程師?(轉)
本文轉載自 百家號 念師 https://baijiahao.baidu.com/s?id=1593524964605066107&wfr=spider&for=pc
用Django框架開發一個簡單的企業網站(四)
現在通過後臺可以新建文章分類,並且編輯儲存文章了;由於Django預設的大容量文字欄位是通過一個textarea作為輸入方式,所以我們還需要引入一個富文字編輯器,這裡我推薦KindEditor(http://kindeditor.net/demo.php),配置簡單,功能也齊全。 將下載好的
用Django框架開發一個簡單的企業網站(二)
現在已經搭建好了網站的基本框架,繼續完善後臺功能,既然要寫後臺,自然要準備好資料庫。 資料庫我選擇熟悉的mysql,用的navicat視覺化管理工具,這裡我建立了一個my_web的資料庫;建立好資料庫後在專案目錄下的settings.py檔案內配置資料庫連線資訊: DATABASE
用Django框架開發一個簡單的企業網站(一)
Python有許多不同的 Web 框架,Django是重量級選手中最有代表性的一位,許多成功的網站和APP都基於Django。 既然如此,那麼…… 老規矩,先安裝Django框架,我的Django版本: 安裝完成後在想儲存專案的目錄下執行命令,新建一個專案: djan
用Django框架開發一個簡單的企業網站(三)
接著之前的專案繼續深入開發,後臺和資料庫已經搞定,現在可以寫我們網站的功能了;就寫一個最簡單的功能,釋出企業新聞。開啟app內的models.py檔案,寫兩個資料模型類: from django.db import models class NewsClass(models.Model)
用純numpy實現一個簡單的神經網路(理解)
簡單的一個numpy神經網路示例: import numpy as np class NeuralNetwork(): def __init__(self): #將權重轉換為3×1矩陣,其值從-1到1,平均值為0 self.synaptic_we
用unity 編寫出一個通用的人員類(Person),該類具有姓名(Name)、年齡(Age)、性別(Sex)等域。然後對Person 類的繼承得到一個學生類(Student),該類能夠存放學生的5門
1.<p style="margin-top: 0px; margin-bottom: 0px; font-family: 'Heiti SC Light'; color: rgb(169, 169, 154);"><span style="font-fa
用python來編寫一個超市購物小系統
# author:Iron Qi product_list = [('Iphone',5800), ('Mac Pro',9800), (
用十幾行python程式碼做一個郵件通知管理:實時通知爬蟲異常狀況
如果Python爬蟲發生了故障,希望第一時間來通知自己,這個時候可以通過email來向自己報告。 傳送郵件的協議是SMTP,Python內建對SMTP支援,可以傳送純文字郵件,html郵件,以及帶附件的郵件,Python對SMTP的支援有smtplib和
用Python來寫一個男女相親小程式|碼農的情人節
碼農這個群體,高學歷,高工資,高智商,但是不善於交流,圈子也很小,相信很多小夥伴或者周圍的小夥伴,都有相親的經歷,或者被父母逼去相親的經歷,一般都是問年齡,你要找什麼樣的,有的還特講究生肖匹配,記得網上有一個段子,說男的20-60歲都只喜歡一種型別的女孩,而20歲到60歲的女孩相親需求卻不斷
(用python來繪製一個空心菱形) 輸入一個整數n,輸出一個空心菱形,其中每個邊由n個'*'組成。
def kongxin(n): for i in range(n): print() for j in range(n - i - 1): print(' ', end='') for k in range(2 * i + 1): if k==0
【工作筆記】Socket、TCP到底是什麼,我可以用Python來做實驗嗎?
Socket 中文是套接字。這個翻譯總感覺誤人子弟,至少大一大二時的我就看不懂,直到現在才明白。其實Socket本質就是對網路傳輸行為的封裝,通過這個封裝我們可以無視網路層、鏈路層和傳輸層的是怎麼做的。 我只要告訴它,我要用到的協議型別是TCP還是UDP。
給Python爬蟲做一個介面.上
<p>做爬蟲做了那麼久,開始逐漸不滿足寫好程式,每次只能完成一件事情。開始思考如何可以做一個簡單介面互動,再增加爬蟲的可操作室,做互動介面有兩個思路:</p> 用Django做一個web介面; 用PyQt做一個exe程式介面; <p>事實上