실용적인 IT생활/Python
-
Text Change Event실용적인 IT생활/Python 2021. 10. 22. 00:17
from tkinter import * # Tkinter 인스턴스 생성 win = Tk() # Window 사이즈 지정 win.geometry("700x350") # Text 변경 Function 정의 def on_click(): label["text"] = "Python" b["state"] = "disabled" # Label 생성 label = Label(win, text="Text", font=('Calibri 15 bold')) label.pack(pady=20) # 버튼 생성 b = Button(win, text="Update Text", command=on_click) b.pack(pady=20) win.mainloop()
-
Tkinter를 활용한 Text Console 출력실용적인 IT생활/Python 2021. 10. 22. 00:16
import tkinter as tk import tkinter.font as tkFont root = tk.Tk() root.geometry("500x440") "창 사이즈 지정" def getTextInput(): result=textExample.get("1.0","end") print(result) textExample=tk.Text(root, height=10) textExample.pack() fontExample = tkFont.Font(family="Arial", size=16, weight="bold", slant="italic") "Font 변경" textExample.configure(font=fontExample) btnRead=tk.Button(root, height=1, widt..
-
Tkinter를 이용하여 Hello World 만들기실용적인 IT생활/Python 2021. 10. 22. 00:15
import tkinter as tk root = tk.Tk() "Tkinter를 초기화하기 위해 Tk Root 위젯을 만듬." "Root 위젯은 가장 먼저 만들어져야 하며 프로그램에 하나만 존재함" root.title('Test') "Root 위젯의 타이틀 설정함" w = tk.Label(root, text="Hello World!\nWelcome") "Root 위젯의 자식으로 Label 위젯을 만듬" w.pack() "pack()을 호출하여 주어진 텍스트에 맞게 크기를 조절하고, 텍스트를 업데이트함" root.mainloop() " 윈도우를 닫을 때까지 이벤트 루프를 실행함"
-
Python 및 PyCharm 설치실용적인 IT생활/Python 2021. 10. 21. 23:56
1. https://www.python.org/ 접속 - 자신의 컴퓨터 OS에 맞는 항목을 다운로드 2. 다운로드 파일 설치 3. PyCharm 설치 - 파이참(PyCharm)은 파이썬 개발에 가장 널리 사용되는 통합 개발 환경(IDE, Integrated Development Environment) 또는 개발 도구 입니다. - jetbrains 사 공식 홈페이지(https://www.jetbrains.com/pycharm/download/)에서 다운로드할 수 있습니다. - 무료로 사용할 수 있는 Community 버전을 다운받습니다. 4. PyCharm 설치 파일 실행 5. PyCharm 실행