def __init__(self):
        self.window = self.build_window()

        self.panel = Indicator(self.window,
                               font=("Arial", 12),
                               width=30,
                               height=3)
        self.panel.pack()
        self.panel.place(x=200, y=0, anchor="n")

        self.var1 = tk.BooleanVar(value=False)
        self.check_button_01 = tk.Checkbutton(self.window,
                                              text='python',
                                              variable=self.var1,
                                              onvalue=True,
                                              offvalue=False,
                                              command=self.update_text)
        self.check_button_01.pack()
        self.check_button_01.place(x=200, y=100, anchor="n")

        self.var2 = tk.BooleanVar(value=False)
        self.check_button_02 = tk.Checkbutton(self.window,
                                              text='C++',
                                              variable=self.var2,
                                              onvalue=True,
                                              offvalue=False,
                                              command=self.update_text)
        self.check_button_02.pack()
        self.check_button_02.place(x=200, y=150, anchor="n")

        self.quit_button = Button(self.window, text="Quit", width=10, height=2)
        self.quit_button.set("command", self.quit)
        self.quit_button.pack()
        self.quit_button.place(x=200, y=280, anchor="s")
    def __init__(self):
        self.window = self.build_window()

        self.panel = Indicator(self.window, bg="red", font=("Arial", 12), width=30, height=3)
        self.panel.pack()
        self.panel.place(x=200, y=80, anchor="n")
        
        self.button = Button(self.window, text="Ok", width=10, height=2)
        self.button.set("command", self.click_button())
        self.button.pack()
        self.button.place(x=20, y=280, anchor="sw")

        self.quit_button = Button(self.window, text="Quit", width=10, height=2)
        self.quit_button.set("command", self.quit)
        self.quit_button.pack()
        self.quit_button.place(x=380, y=280, anchor="se")
    def __init__(self):
        self.window = self.build_window()

        self.panel = Indicator(self.window,
                               font=("Arial", 12),
                               width=30,
                               height=3)
        self.panel.pack()
        self.panel.place(x=200, y=0, anchor="n")

        self.menu = tk.Menu(self.window)
        self.filemenu = tk.Menu(self.menu)
        self.menu.add_cascade(label="file", menu=self.filemenu)
        self.editmenu = tk.Menu(self.menu)
        self.menu.add_cascade(label="edit", menu=self.editmenu)
        self.submenu = tk.Menu(self.filemenu)
        self.filemenu.add_cascade(label="import", menu=self.submenu)

        self.filemenu.add_command(label="New", command=self.do_job())
        self.filemenu.add_command(label="Open", command=self.do_job())
        self.filemenu.add_command(label="Save", command=self.do_job())
        self.filemenu.add_command(label="exit", command=self.quit)

        self.editmenu.add_command(label="cut", command=self.do_job())
        self.editmenu.add_command(label="copy", command=self.do_job())
        self.editmenu.add_command(label="paste", command=self.do_job())
        self.window.config(menu=self.menu)

        self.quit_button = Button(self.window, text="Quit", width=10, height=1)
        self.quit_button.set("command", self.quit)
        self.quit_button.pack()
        self.quit_button.place(x=200, y=260, anchor="s")
Beispiel #4
0
    def __init__(self):
        self.window = self.build_window()

        optionlist = [
            "showinfo", "showwarning", "showerror", "askyesno",
            "askretrycancel", "askquestion", "askokcancel"
        ]
        self.optionmenu = Optionmenu(self.window, optionlist)
        self.optionmenu.pack()
        self.optionmenu.place(x=200, y=40, anchor="n")

        self.button = Button(self.window, text="Ok", width=10, height=2)
        self.button.set("command", self.click_button)
        self.button.pack()
        self.button.place(x=200, y=120, anchor="n")

        self.quit_button = Button(self.window, text="Quit", width=10, height=2)
        self.quit_button.set("command", self.quit)
        self.quit_button.pack()
        self.quit_button.place(x=200, y=200, anchor="n")
Beispiel #5
0
    def __init__(self):
        self.window = self.build_window()

        self.panel = Indicator(self.window,
                               font=("Arial", 12),
                               width=30,
                               height=3)
        self.panel.pack()
        self.panel.place(x=200, y=0, anchor="n")

        self.var0 = tk.StringVar(value="")
        self.radio_button_01 = tk.Radiobutton(self.window,
                                              text='Option A',
                                              variable=self.var0,
                                              value='A',
                                              command=self.update_text)
        self.radio_button_01.pack()
        self.radio_button_01.place(x=200, y=100, anchor="n")
        self.radio_button_02 = tk.Radiobutton(self.window,
                                              text='Option B',
                                              variable=self.var0,
                                              value='B',
                                              command=self.update_text)
        self.radio_button_02.pack()
        self.radio_button_02.place(x=200, y=150, anchor="n")

        self.var1 = tk.StringVar(value="")
        self.radio_button_03 = tk.Radiobutton(self.window,
                                              text='Option C',
                                              variable=self.var1,
                                              value='C',
                                              command=self.update_text)
        self.radio_button_03.pack()
        self.radio_button_03.place(x=200, y=200, anchor="n")
        self.var2 = tk.StringVar(value="")
        self.radio_button_04 = tk.Radiobutton(self.window,
                                              text='Option D',
                                              variable=self.var2,
                                              value='D',
                                              command=self.update_text)
        self.radio_button_04.pack()
        self.radio_button_04.place(x=200, y=250, anchor="n")

        self.panel.set_text(
            f"var0: {self.var0.get()}, var1: {self.var1.get()}, var2: {self.var2.get()}"
        )

        self.quit_button = Button(self.window, text="Quit", width=10, height=2)
        self.quit_button.set("command", self.quit)
        self.quit_button.pack()
        self.quit_button.place(x=200, y=380, anchor="s")
Beispiel #6
0
    def __init__(self):
        self.window = self.build_window()

        self.panel = Indicator(self.window,
                               font=("Arial", 12),
                               width=30,
                               height=3)
        self.panel.pack()
        self.panel.place(x=200, y=0, anchor="n")

        self.listbox = Listbox(self.window, ["A", "B", "C", "D"], height=4)
        self.listbox.pack()
        self.listbox.place(x=200, y=80, anchor="n")

        self.button = Button(self.window, text="Ok", width=10, height=1)
        self.button.set("command", self.click_button)
        self.button.pack()
        self.button.place(x=200, y=220, anchor="s")

        self.quit_button = Button(self.window, text="Quit", width=10, height=1)
        self.quit_button.set("command", self.quit)
        self.quit_button.pack()
        self.quit_button.place(x=200, y=260, anchor="s")
    def __init__(self):
        self.window = self.build_window()

        self.canvas = tk.Canvas(self.window, height=200, width=200)
        self.canvas.place(x=200, y=0, anchor="n")
        x0, y0, x1, y1= 50, 50, 80, 80
        self.canvas.create_line(x0, y0, x1, y1)
        self.canvas.create_oval(x0, y0, x1, y1, fill='red')
        self.canvas.create_arc(x0+30, y0+30, x1+30, y1+30, start=0, extent=180)
        self.canvas.create_rectangle(100, 30, 100+20, 30+20)
        self.canvas.pack()

        self.quit_button = Button(self.window, text="Quit", width=10, height=2)
        self.quit_button.set("command", self.quit)
        self.quit_button.pack()
        self.quit_button.place(x=200, y=280, anchor="s")