기본 콘텐츠로 건너뛰기

라벨이 tkinter인 게시물 표시

tkinter 콤보박스 간단사용예

 tkinter 의 간단한 콤보박스 사용예입니다.  콤보박스에서 컬러를 선택하면 그 아래 Label 의 배경색이 변합니다.  그 아래 Progressbar 는 그냥 심심해서(?) 넣어 본것 입니다. indeterminate 모드로 넣은 것인데 indeterminate 모드는 정확한 진행정도를 나타내는게 아니라 그냥 진행중이라는걸 표시하는 것입니다. 진행바가 그냥 좌우로 움직이기만 합니다.  from tkinter import * from tkinter.ttk import * from tkinter.messagebox import *   class Application(Frame):     def __init__(self, master=None):         super().__init__(master)         self.master = master         self.pack(side="top")         self.create_widgets()       def create_widgets(self):         self.cb = Combobox(width=10,value=['white','blue','yellow','black','red'])         self.cb.current(0)         self.cb.bind("<<ComboboxSelected>>", self.chan...

tkinter 기본 위젯 사용예

  그냥 tkinter 가 어떻게 쓰이는지 기본적인 작동을 하도록 만들어 본 것 입니다. 기본 골격은 파이썬 도큐먼트에 있는 예제 소스에서 가져왔고 거기에 살을 좀 붙였습니다. 가장 많이 쓰는 Label 과 버튼, 에디트 컨트롤의 기본적인 사용예 입니다. import tkinter as tk from tkinter import ttk from tkinter import messagebox class Application(ttk.Frame):     def __init__(self, master=None):         super().__init__(master)         self.master = master         self.pack(side="top")         self.create_widgets()     def create_widgets(self):         style = ttk.Style()        #style 설정         style.configure("BW.TLabel", foreground="black", background="white")                  self.l1 = ttk.Label(text = "Label1", style = "BW.TLabel")    ...