Advertisement
Guest User

Untitled

a guest
Aug 25th, 2017
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.80 KB | None | 0 0
  1. # import the library
  2. from appJar import gui
  3. from os import listdir
  4.  
  5.  
  6. # grid tip
  7. # "row=1 column=2 colspan=1 rowspan=2", 1, 2, 1, 2)
  8.  
  9. # handle button events
  10. def press(button):
  11.     if button == "Cancel" or button == "Выход":
  12.         app.stop()
  13.     elif button == "Выбрать":
  14.         name = app.getListItems("list")[0]
  15.         app.setLabel("header", name[:-4])
  16.         otv=open(name).readlines()[0].split(";")
  17.         app.setLabel("main_phrase", otv)
  18.     else:
  19.         usr = "123"
  20.         pwd = app.getEntry("Password")
  21.         print("User:", usr, "Pass:", pwd)
  22.  
  23. # create a GUI variable called app
  24. app = gui("Dictionary fiesta", "1280x550")
  25. app.setFont(18)
  26. app.setResizable(canResize=False)
  27. app.setStretch("both")
  28.  
  29. # Name of the current file being processed
  30. app.addLabel("header", "Общий диктант на разные правила", row=0, column=0, colspan=2)
  31.  
  32. # Left column with files list and exit buttons
  33. app.startPanedFrame("select_window", row=1, column=0)
  34.  
  35. files = listdir("./")
  36. mytxt = list(filter(lambda x: x.endswith('.txt'), files))
  37.  
  38. app.addListBox("list", mytxt, 1,2,1,2)
  39. app.addButtons(["Выбрать", "Выход"], press, row=3, column=2)
  40. app.stopPanedFrame()
  41. app.getListBoxWidget("list").config(width=1)
  42.  
  43.  
  44. # Right column with main actions
  45. app.startLabelFrame("main_window", row=1, column=1)
  46. app.addLabel("main_phrase", "без_дейный")
  47. app.getLabelWidget("main_phrase").config(font="Times 30", width=30)
  48.  
  49. # variants buttons
  50. app.startPanedFrame("p1")
  51. app.addButtons(["ы", "и"], press)
  52. app.stopPanedFrame()
  53.  
  54. app.setLabelSticky("main_phrase", "wns")
  55. app.setPanedFrameSticky("p1", "ew")
  56. app.stopLabelFrame()
  57.  
  58. app.setPanedFrameSticky("select_window", "nsw")
  59. app.setLabelFrameSticky("main_window", "nsew")
  60.  
  61. # start the GUI
  62. app.go()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement