Beispiel #1
0
    ).pack(anchor=W, padx=(2, 0))

    form = Form(
        root,
        action=lambda data: messagebox.showinfo("form data", pp.pformat(data)))
    form.pack(expand=True, fill="both", ipadx=10, ipady=10)

    # It's possible to provide hidden data
    form.hidden_input["hidden_var1"] = "value1"
    form.hidden_input["hidden_var2"] = "value2"

    Label(form, text="Entry:").grid(row=0, column=0, sticky=E, pady=(8, 0))

    # The fieldname attribute is necessary to provide data to action
    entry = Entry(form)
    entry.fieldname = "entry"
    entry.grid(row=1, column=1, sticky=E + W)

    Label(form, text="Checkbuttons:").grid(row=2,
                                           column=0,
                                           sticky=E,
                                           pady=(8, 0))
    column = Frame(form)
    column.grid(row=3, column=1, sticky=E + W)

    checkbutton0 = Checkbutton(column, text="Option 0")
    checkbutton0.fieldname = "checkbutton0"
    checkbutton0.pack(side=LEFT)

    checkbutton1 = Checkbutton(column, text="Option 1")
    checkbutton1.fieldname = "checkbutton1"
Beispiel #2
0
      height=1,
      font=('arial', 12, 'bold'),
      text="Question:",
      bg="#99ccff",
      fg='blue4',
      bd=20,
      anchor='w').grid(row=1, column=0, sticky=E, pady=(0, 0))

#function to show and print question
entry = Entry(form,
              font=('arial', 10, 'bold'),
              width=120,
              bd=13,
              bg="#99ccff",
              fg="#012b74")
entry.fieldname = "Question"
entry.grid(row=1, column=1, sticky=E + W)
entry.delete(0, END)
str3 = generateQuestion()
entry.insert(0, (str3))

Label(form,
      font=('arial', 12, 'bold'),
      text="Answer write here:",
      bg="#99ccff",
      fg="#012b74",
      bd=10,
      anchor='w').grid(row=5, column=0, sticky=E, pady=(8, 2))
text1 = Text(form,
             font=('arial', 12, 'bold'),
             height=2,
Beispiel #3
0
    root= Tk()

    Label(root, text="Fill form and click submit button to execute action (open a popup) with all the form data.").pack(anchor=W, padx=(2,0))

    form = Form(root, action =lambda data: messagebox.showinfo("form data",pp.pformat(data)))
    form.pack(expand=True, fill="both", ipadx=10, ipady=10)

    # It's possible to provide hidden data
    form.hidden_input["hidden_var1"] = "value1"
    form.hidden_input["hidden_var2"] = "value2"

    Label(form, text="Entry:").grid(row=0,column=0, sticky=E, pady=(8,0))

    # The fieldname attribute is necessary to provide data to action
    entry = Entry(form)
    entry.fieldname = "entry"
    entry.grid(row=1,column=1, sticky =E+W)
    
    Label(form, text="Checkbuttons:").grid(row=2,column=0, sticky=E, pady=(8,0))
    column = Frame(form)
    column.grid(row=3,column=1, sticky =E+W)

    checkbutton0 = Checkbutton(column, text="Option 0")
    checkbutton0.fieldname = "checkbutton0"
    checkbutton0.pack(side=LEFT)

    checkbutton1 = Checkbutton(column, text="Option 1")
    checkbutton1.fieldname = "checkbutton1"
    checkbutton1.pack(side=LEFT)
    
    checkbutton2 = Checkbutton(column, text="Option 2")