Last active
November 28, 2017 01:50
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import System.FilePath.Posix | |
import MySpinBox | |
import Graphics.UI.Gtk | |
import Ch | |
fn = "tmp" | |
main = do | |
l <- readFile fn | |
let [a,b,c] = read l::[Double] | |
initGUI | |
window <- windowNew | |
hbox <- hBoxNew False 0 | |
vbox <- vBoxNew False 0 | |
boxPackStart vbox hbox PackNatural 0 | |
let spmods = [(a, 30, 60 ,1 , 10), | |
(b, 10, 30, 1, 10), | |
(c, 100, 1000 ,1, 10)] | |
let names = ["大ギヤ(T)" ,"小ギヤ(T)","rc(mm)"] | |
adjs <- mkAdjustments spmods | |
spins <- myAddSpinButtons hbox names adjs | |
mapM_ (`set` [spinButtonDigits := 0]) spins | |
mapM_ (\x-> onValueChanged x (update adjs)) adjs | |
containerAdd window vbox | |
widgetShowAll window | |
window `on` unrealize $ end adjs | |
mainGUI | |
update adjs = do | |
a:b:c:_ <- mapM (`get` adjustmentValue) adjs | |
print a | |
print b | |
print c | |
print $ chlen a b c / pitch | |
end adjs = do | |
a:b:c:_ <- mapM (`get` adjustmentValue) adjs | |
writeFile fn $ show [a,b,c] | |
mainQuit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment