python 介面程式設計

2021-06-02 05:06:33 字數 1167 閱讀 6646

**:

import tkinter

top = tkinter.tk() 

label = tkinter.label(top, text='hello wrold' )

label.pack()  #管理和顯示元件

tkinter.mainloop()

import tkinter

#按鈕的使用

top = tkinter.tk()

button = tkinter.button(top, text='exit', command=top.quit)

button.pack()

tkinter.mainloop()

import tkinter

#按扭和標籤的使用

top = tkinter.tk()

label = tkinter.label(top, text='hello,world')

label.pack()

button = tkinter.button(top, text='exit', command=top.quit, bg='red', fg='white')

button.pack(fill=tkinter.x, expand=1)

tkinter.mainloop()

#用標籤控制字型大小

import tkinter

def resize(ev=none):

label.config(font='helvetica -%d bold' % \

scale.get())

top = tkinter.tk()

top.geometry('250x150')

label = tkinter.label(top, text='hello,world',\

font='helvetica -12 bold')

label.pack(fill=tkinter.y, expand=1)

scale = tkinter.scale(top, from_=10, to=40,\

orient=tkinter.horizontal, command=resize)

scale.set(12)

scale.pack(fill=tkinter.x, expand=1)

top.mainloop()

python介面程式設計 R程式語言的Python介面

正如 lgautier所指出的那樣,在這個問題上已經有了另乙個答案。我在這裡留下我的答案,因為它增加了將r作為新手的經驗,首先了解python。我同時使用python和r,並同意您作為r的新手的需要。由於您得到的任何答案都是主觀的,因此,根據我的經驗,我總結了幾點 但是不要指望在不學習兩者的情況下,...

python介面 python 介面

一 urllib模組 urllib模組是乙個標準模組,直接import urllib即可,在python3裡面只有urllib模組,在python2裡面有urllib模組和urllib2模組。urllib模組太麻煩了,傳引數的話,都得是bytes型別,返回資料也是bytes型別,還得解碼,想直接把返...

python3介面程式設計 Python3程式設計技巧

in 1 fromrandom import randint in 2 data randint 10,10 for in range 10 in 3 data out 3 3,4,3,4,7,2,4,1,7,9 過濾列表中的負數 in 9 list filter lambda x x 0,data...