Day17 参加职训(机器学习与资料分析工程师培训班),Python程序设计

练习使用selenium来登入FB

from selenium import webdriver

driver = webdriver.Chrome()
driver.get('https://www.facebook.com/')
driver.find_element_by_id('email').send_keys('E-mail')
driver.find_element_by_id('pass').send_keys('密码')
driver.find_element_by_name('login').click()
#driver.close()

使用tkinter模组制作GUI画面

import tkinter as tk
base = tk.Tk()
Label01 = tk.Label(base, text = 'Red', bg = 'red', font = ('Arial', 12), width = 20).pack()
Label02 = tk.Label(base, text = 'Green', bg = 'green', width = 20, height = 3).pack()
Label03 = tk.Label(base, text = 'Blue', fg = 'white', bg = 'blue', width = 20).pack()
base.mainloop()

https://ithelp.ithome.com.tw/upload/images/20210722/20139039QkTIczrWl1.png

base = tk.Tk()
textvar = tk.StringVar() # 设定一个tk的字串变数
Label01 = tk.Label(base, textvariable = textvar, fg = 'white', bg = 'red', font = ('Arial', 12), width = 20, height = 2).pack()
textvar.set('Hello World !!!')
base.mainloop()

https://ithelp.ithome.com.tw/upload/images/20210722/2013903968LgTJQ3JR.png

# Radiobutton
import tkinter as tk
def select():
    selection = 'Radio button ' + str(My_value.get()) + ' is chosen'
    My_String.set(selection)


base = tk.Tk()
My_String = tk.StringVar()
My_value = tk.IntVar()

Button01 = tk.Radiobutton(base, text = 'Option01', variable = My_value, value = 1, command = select).pack()
Button02 = tk.Radiobutton(base, text = 'Option02', variable = My_value, value = 2, command = select).pack()
Button03 = tk.Radiobutton(base, text = 'Option03', variable = My_value, value = 3, command = select).pack()
Label01 = tk.Label(base, textvar = My_String).pack()
base.mainloop()

https://ithelp.ithome.com.tw/upload/images/20210722/20139039KLdUigEdRw.png

# Checkbutton
def leave():
    base.destroy()

base = tk.Tk()

Choice01 = tk.IntVar()
Choice02 = tk.IntVar()
Choice03 = tk.IntVar()

CB01 = tk.Checkbutton(base, text = 'Math', variable = Choice01, offvalue = 0,onvalue = 1, ).pack(anchor = tk.W)
CB02 = tk.Checkbutton(base, text = 'Chinese', variable = Choice02, offvalue = 0,onvalue = 1, ).pack(anchor = tk.W)
CB03 = tk.Checkbutton(base, text = 'English', variable = Choice03, offvalue = 0,onvalue = 1, ).pack(anchor = tk.W)

Button01 = tk.Button(base, text = 'Submit', command=leave).pack()

base.mainloop()

https://ithelp.ithome.com.tw/upload/images/20210722/201390397F3XMGJoJB.png


<<:  掌握SEO优化3大要点,让搜寻引擎知道「我就是你要的网站!」

>>:  如何下载痞客邦的图片

【JavaScript】阵列方法之indexOf()

【前言】 本系列为个人前端学习之路的学习笔记,在过往的学习过程中累积了很多笔记,如今想藉着IT邦帮忙...

Day13-React 表单验证篇-使用第三方函式库 Formik 进行表单的验证

Formik 介绍 在进行实作之前,先来认识一下 Formik 吧~ 如标题所说,Formik 是一...

伸缩自如的Flask [day 24] GCP app engine (deploy)

接续着昨天的进度,首先可以先准备你的程序,而我在github 上有放上范例: https://git...

【左京淳的JAVA WEB学习笔记】第八章 服务器异步设定

在特定时间开放抢票的网站,常常会有流量爆炸的问题。这时候可以透过服务器的异步处理来解决。 让买票处理...

DAY6 JS跑在浏览器上的怪问题们

简单回顾一下,第一天讲了HTML5常用的几种tag。二到四天,深入聊了CSS中float原理,实作圣...