Posted to tcl by rszulgo at Tue Jan 12 02:32:18 GMT 2010view raw

  1. #!/usr/bin/tclsh
  2. package require Tk
  3.  
  4. #\u0141adowanie biblioteki
  5. load tclsqlite-3.6.22.so sqlite3
  6.  
  7. #\u0141\u0105czenie z baz\u0105 danych
  8. sqlite3 db baza.db
  9.  
  10. #Wykonanie zapytania
  11. db eval {SELECT * FROM przedmioty} x {
  12.  
  13. foreach v $x(*) {
  14. $msg = $v = $x($v)
  15. }
  16.  
  17. puts ""
  18.  
  19. }
  20.  
  21. # Tworzymy wiadomosc
  22. message .m -text "Hello Tcl!" -background white
  23. pack .m -expand true -fill both -ipadx 100 -ipady 40
  24.  
  25. # Tworzymy pasek menu z Menu "Help"
  26. menu .menubar
  27. menu .menubar.help -tearoff 0
  28. .menubar add cascade -label "Help" -menu .menubar.help -underline 0
  29. .menubar.help add command -label "O Hello ..." -accelerator "F1" -underline 0 -command showAbout
  30.  
  31. # Define a procedure - an action for Help-About
  32. proc showAbout {} {
  33. tk_messageBox -message "Tcl/Tk\nWitamy na Zaawansowanej Analizie Danych\nVersion 1.0" -title "O Hello"
  34. }
  35.  
  36.  
  37.  
  38.  
  39. # Configure the main window
  40. wm title . "Zaawansowana Analiza Danych"
  41. . configure -menu .menubar -width 200 -height 150
  42.  
  43. #Binding na skrót
  44. bind . "<Key F1>" {showAbout}
  45.  
  46. db close