Stock market is a typical complex system with a great number of agents interacting with each other. Recent global financial crisis has shown the importance of understanding the dynamics of the stock market in details with a close look at its complexity. In the complexity science, two entropy approaches have been widely used, i.e. maximum entropy principle and multiscale entropy, and in this paper I define the generalized entropy of the market with fully consideration of the complex interactions among various agents. Following the first approach, the whole market, as an open system, always has an optimization process so that the generalized entropy of the whole stock market is maximal under the given constraints. And I have derived the nonlinear dynamic equation for the stock market is accordingly. Following the second approach, I have been able to identify certain market patterns in different scales for different financial quantities. Using empirical data from both Chinese and US stock markets, simulations, profound discussions and comparison are provided. Thus, a new framework for studying the dynamics of stock market is obtained, which will be very useful for the market investors, analysts and regulators.