[Xuefeng magnetic needle stone blog] python tkinter graphic tool style job

python test development project practice directory python tools book download - continuous update Use tkinter to draw the following window Reference ...

Use tkinter to draw the following window

Reference material

Code

#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Technical support: https://www.jianshu.com/u/69f40328d4f0 # Technical support https://china-testing.github.io/ # https://github.com/china-testing/python-api-tesing/blob/master/practices/tk/tk4.py # Project practical discussion QQ group 630011153 144081101 # CreateDate: 2018-12-02 import tkinter as tk root = tk.Tk() root.configure(background='#4D4D4D') #top level styling # connecting to the external styling optionDB.txt root.option_readfile('optionDB.txt') #widget specific styling text = tk.Text( root, background='#101010', foreground="#D6D6D6", borderwidth=18, relief='sunken', width=17, height=5) text.insert( tk.END, "Style is knowing who you are,what you want to say, and not giving a damn." ) text.grid(row=0, column=0, columnspan=6, padx=5, pady=5) # all the below widgets derive their styling from optionDB.txt file tk.Button(root, text='*').grid(row=1, column=1) tk.Button(root, text='^').grid(row=1, column=2) tk.Button(root, text='#').grid(row=1, column=3) tk.Button(root, text='<').grid(row=2, column=1) tk.Button( root, text='OK', cursor='target').grid( row=2, column=2) #changing cursor style tk.Button(root, text='>').grid(row=2, column=3) tk.Button(root, text='+').grid(row=3, column=1) tk.Button(root, text='v').grid(row=3, column=2) tk.Button(root, text='-').grid(row=3, column=3) for i in range(10): tk.Button( root, text=str(i)).grid( column=3 if i % 3 == 0 else (1 if i % 3 == 1 else 2), row=4 if i <= 3 else (5 if i <= 6 else 6)) root.mainloop()

You can use the hexadecimal color code to specify the color for the scale of red (r), green (g), and blue (b). The commonly used expressions are ා rgb (4 bits), ා rrggbb (8 bits) and ා rrrgggbbb (12 bits).

For example, ff is white, 000000 is black, f00 is red (R = 0xf, G = 0x0,
B = 0x0), 00ff00 is green (R = 0x00, G = 0xff, B = 0x00), 000000fff is blue (R = 0x000, G = 0x000, B = 0xfff).

Alternatively, Tkinter provides a mapping of standard color names. For a list of predefined named colors, visit http://wiki.tcl.tk/37701 or http://wiki.tcl.tk/16166.

2 December 2019, 15:31 | Views: 9358

Add new comment

For adding a comment, please log in
or create account

0 comments