图形练习设置按钮

import tkinter
from tkinter import *


def callback():
    print("你点一下按钮")

def turn_on():   #开启按钮
    button1.config(state="disabled")
    button2.config(state="active")

def turn_off():  #关闭按钮
    button1.config(state="active")
    button2.config(state="disabled")


root = Tk()
root.title("杨焱")  #窗口名称
root.iconbitmap("bitbug_favicon.ico")  #ico图标
root.geometry("300x300")  #窗体长宽
root.config(bg="blue")  #背景颜色


lab = Label(root, text="Hello, Tkinter!")
lab.pack()



#   lab = Label(root, text="Hello!", font=("黑体", 20)) #字体为黑体,大小20;顺序不能颠倒
#   lab = Label(root, text="Hello!", font=20) #只设置大小20
#   lab = Label(root, text="Hello!", font="黑体") #只设置字体为黑体


#   Label(root, text="杨焱", font=("黑体", 20, "bold")).pack()
#Label(root, text="谭媛", font=("黑体", 20, "italic")).pack()
#Label(root, text="王兴维", font=("黑体", 20, "underline")).pack()
#Label(root, text="删除线", font=("黑体", 20, "overstrike")).pack()
#Label(root, text="叠加使用", font=("黑体", 20, "bold", "italic", "underline", "overstrike")).pack()

#root.resizable(False, False)

#mainloop()




#
#cursorList = ['arrow', 'xterm', 'watch', 'hand2', 'question_arrow', 'sb_h_double_arrow', 'sb_v_double_arrow', 'fleur',
 #            'crosshair', 'based_arrow_down', 'based_arrow_up', 'boat', 'bogosity', 'top_left_corner',
  #            'top_right_corner', 'bottom_left_corner', 'bottom_right_corner', 'top_side', 'bottom_side', 'top_tee',
   #           'bottom_tee', 'box_spiral', 'center_ptr', 'circle', 'clock', 'coffee_mug', 'cross', 'cross_reverse',
    #          'diamond_cross', 'dot', 'dotbox', 'double_arrow', 'top_left_arrow', 'draft_small', 'draft_large',
     #         'left_ptr', 'right_ptr', 'draped_box', 'exchange', 'gobbler', 'gumby', 'hand1', 'heart', 'icon',
      #        'iron_cross', 'left_side', 'right_side', 'left_tee', 'right_tee', 'leftbutton', 'middlebutton',
       #       'rightbutton', 'll_angle', 'lr_angle', 'man', 'mouse', 'pencil', 'pirate', 'plus', 'rtl_logo', 'sailboat',
        #      'sb_left_arrow', 'sb_right_arrow', 'sb_up_arrow', 'sb_down_arrow', 'shuttle', 'sizing', 'spider',
         #     'spraycan', 'star', 'target', 'tcross', 'trek', 'ul_angle', 'umbrella', 'ur_angle', 'X_cursor']
# 所有的光标样式


button1 = Button(root, text="开启", command=turn_on,activeforeground="blue",activebackground="yellow")
button2 = Button(root, text="关闭", command=turn_off,activeforeground="blue",activebackground="yellow")

button1.pack()
button2.pack()

root.resizable(True, True)
mainloop()
x = input('请输入一个数:')
y = input('请输入一个数:')

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值